Android - Show Custom Notification without default notification- Parse.com

泪湿孤枕 提交于 2019-12-11 04:05:54

问题


Does exist a different way to send a push without show default notification (from Parse library)?

I've created a custom BroadcastReceiver to show notification with full message, but if I send json with "alert" parameter, the default notification is shown by Parse library.

For example:

{ "alert": "Both notifications will be shown", "url": "www.parse.com", "action" : "com.myapp.package.UPDATE_STATUS" }

and

{ "message": "Custom notification will be shown", "url": "www.parse.com", "action" : "com.myapp.package.UPDATE_STATUS" }

The first json shows default notification, because Parse library intercepts the "alert" parameter. The seconds json shows just my custom notification.

The second json would be perfect, but I send push notifications to iOS app too. So, I want to have the same json for Android and iOS. I want to send just one push.

Is it possible to use "alert" parameter and show only custom notification?

Thank you!! Regards


回答1:


Yes, replace :

PushService.setDefaultPushCallback(this, YourActivity.class);

to :

PushService.startServiceIfRequired(this);

Parse BroadcastReceiver no longer receive notifications.

https://www.parse.com/questions/how-suppress-push-notification-from-being-displayed



来源:https://stackoverflow.com/questions/25365510/android-show-custom-notification-without-default-notification-parse-com

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!