android - (Urban airship) How can I remove(or update) previous push message alert? -


my app service android app using phonegap , push alarm service 1 of app services.

current our push alarm service continuously adding message on upside-status-bar push notification alarm.

see >> http://www.givetime.co.kr/qna.png

but want replace message newest 1 not add, i.e. want display 1 message on bar.

how can replace or how can display 1 message?

this push alarm service code.

send alarm code "https://go.urbanairship.com/api/push/ " post json message :

{ "apids": [ "user apid", ], "android": { "alert": "you received message." } } 

by default, urban airship display messages receives in status bar, can change behavior setting own notification builder , setting variable constantnotificationid integer bigger 0 in order replace previous notifications.

here example of how configure custompushnotificationbuilder in android application class:

 custompushnotificationbuilder nb = new custompushnotificationbuilder();     nb.layout = r.layout.notification_layout; // layout resource use    nb.layouticondrawableid = r.drawable.notification_icon; // icon want display    nb.layouticonid = r.id.icon; // icon's layout 'id'    nb.layoutsubjectid = r.id.subject; // id 'subject' field    nb.layoutmessageid = r.id.message; // id 'message' field     //set id value > 0 if want new notification replace previous 1    nb.constantnotificationid = 100;     //set if want custom sound play    nb.sounduri = uri.parse("android.resource://"+this.getpackagename()+"/" +r.raw.notification_mp3);     // set builder    pushmanager.shared().setnotificationbuilder(nb); 

you can check more information in urban airship documentation


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -