Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid notification shows just the last notificatoin
    primarykey
    data
    text
    <p>I have application android which gives data from server, i want to make notifications, one notification for each row of data, I want when the user press on the notification, an activity is triggered, i want to do all that using android service, i could do all of that. </p> <p>my problem is that whatever the notification the user press, it just shows the last row of data.</p> <p>code:</p> <pre><code>lient client = new Client(Configuration.getServer()); String str = client.getBaseURI("offers"); try { JSONArray json = new JSONArray(str); for (int i = 0; i &lt; json.length(); i++) { JSONObject oneOffer = json.getJSONObject(i); int offerID = oneOffer.getInt("ID"); String offerDescriptoin = oneOffer.getString("Description"); String endDate = oneOffer.getString("EndDate"); String startDate = oneOffer.getString("StartDate"); JSONObject restaurant = oneOffer.getJSONObject("Restaurant"); int restaruantID = restaurant.getInt("ID"); String restaurantName = restaurant.getString("Name"); Offer offer = new Offer(offerID, startDate, endDate, offerDescriptoin, new Restaurant(restaruantID, restaurantName)); Log.d("DES", offerDescriptoin); Offer.getAllOffers().put(offer.getID(), offer); Intent intent = new Intent(this, OfferNotification.class); PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0); Uri soundUri = RingtoneManager .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( this).setSmallIcon(R.drawable.ic_launcher) .addAction(R.drawable.ic_launcher, "call", pIntent) .addAction(R.drawable.ic_launcher, "more", pIntent) .addAction(R.drawable.ic_launcher, "add more", pIntent) .setContentTitle("Offer from " + restaurantName) .setContentText(offerDescriptoin).setSound(soundUri); // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(this, OfferNotification.class); resultIntent.putExtra("offerID", offer.getID()); TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); stackBuilder.addParentStack(OfferNotification.class); stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder .getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(offer.getID(), mBuilder.build()); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload