Phonegap PushPlugin reset badge after opening app

孤者浪人 提交于 2019-12-24 02:35:10

问题


How can I prevent PushPlugin from reseting my badge count to 0 after entering the app from the background?


回答1:


I just came across this problem as well.

For some reason this is intended behaviour. It's because in the com.phonegap.plugins.PushPlugin, the badge get cleared to 0 when the app get active again.

I ended up editing the plugin:

In the file "AppDelegate+notification.m", in the method:

"- (void)applicationDidBecomeActive:(UIApplication *)application {"

Change line ~90:

//zero badge
application.applicationIconBadgeNumber = 0;

to:

//zero badge
//application.applicationIconBadgeNumber = 0;

(I just ended up commenting it out).



来源:https://stackoverflow.com/questions/24601874/phonegap-pushplugin-reset-badge-after-opening-app

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