Notificationlistenerservice Stopping And Can't Be Restarted Without A Reboot
With android 4.4 I'm finding that some users are having the notificationListenerService I've implemented will just stop working. I've actually seen this myself too. I've never mana
Solution 1:
This way can restart it, but it needs about 10s!
privatevoidtoggleNotificationListenerService() {
PackageManager pm = getPackageManager();
pm.setComponentEnabledSetting(new ComponentName(this, com.xinghui.notificationlistenerservicedemo.NotificationListenerServiceImpl.class),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
pm.setComponentEnabledSetting(new ComponentName(this, com.xinghui.notificationlistenerservicedemo.NotificationListenerServiceImpl.class),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
}
Author:Hugo
Link:https://www.zhihu.com/question/33540416/answer/113706620
Post a Comment for "Notificationlistenerservice Stopping And Can't Be Restarted Without A Reboot"