Android NotificationListenerService不';无法检测未接来电通知
我正在使用NotificationListenerService检测何时有新通知以及何时清除。它适用于所有应用程序,但当有未接来电通知时,它不会检测到。如何解决这个问题Android NotificationListenerService不';无法检测未接来电通知,android,android-service,android-notifications,Android,Android Service,Android Notifications,我正在使用NotificationListenerService检测何时有新通知以及何时清除。它适用于所有应用程序,但当有未接来电通知时,它不会检测到。如何解决这个问题 public class NotificationService extends NotificationListenerService { @Override public void onCreate() { super.onCreate(); } @Override
public class NotificationService extends NotificationListenerService {
@Override
public void onCreate() {
super.onCreate();
}
@Override
public void onNotificationPosted(StatusBarNotification sbn) {
Log.d("+*+*","Notification Posted: " + sbn.getPackageName();
}
@Override
public void onNotificationRemoved(StatusBarNotification sbn) {
Log.d("+*+*","Notification Removed: " + sbn.getPackageName()
}
}
在AndroidManifest.xml中
<service
android:name=".NotificationService"
android:label="@string/app_name"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
许可
<uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" tools:ignore="ProtectedPermissions"/>
提前感谢。通知侦听器需要电话状态权限才能检测未接来电通知
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
通知侦听器需要电话状态权限才能检测未接来电通知
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>