NotificationListenerService 未检测到未接来电通知

NotificationListenerService doesn't detect missed calls notification

我正在使用 NotificationListenerService 来检测何时有新通知以及何时清除通知。它适用于所有应用程序,除非有未接来电通知,它不会检测到它。如何解决?

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"/>

提前致谢。

Phone通知侦听器检测未接来电通知需要状态权限。

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>