0

I am working on badges on launcher icon of application in android,I want to get total number of push notification for my app to display as a badge on my app's launcher icon,I am using parse.com for the push notifications in android,So can any buddy please tell me how to get count of push notifications and reflect it in badge in android?

code

Parse.initialize(this, "Hl59kzuF4yGr36XEUZByOgtorvyrYcVm7zAb6amG",
            "YohxPugahDoiBZ2kaQ7qtqmO40y0JmLYkMuT");
    PushService.setDefaultPushCallback(this, QuestionOFDayActivity.class);
user3820044
  • 177
  • 1
  • 3
  • 20

1 Answers1

0

If you are using parse.com then you might have using BroadcastReceiver for handling push notification(if not then use that). So in onRecieve() of Broadcast receiver you can take count as application level. then u will get no. of push notification through out of app.

Edited :

Add this Receiver in your manifest

<receiver android:name="your.package.MyCustomReceiver" android:exported="false">
  <intent-filter>
    <action android:name="your.package.UPDATE_STATUS" />
  </intent-filter>
</receiver>

create new class:-

public class MyCustomReceiver extends BroadcastReceiver {


  @Override
  public void onReceive(Context context, Intent intent) {

    // Here you will get the event when you receive Notification 
    // you can maintain a count here as application level. 
  }
}

If you want detailed doc - Then read this

T_V
  • 17,440
  • 6
  • 36
  • 48