在设置中启用不为应用程序显示的 NotificationListenerService - Android Studio - Java

Enable NotificationListenerService not showing for app in Settings - Android Studio - Java

我对 android 开发有点陌生,我试图制作一个应用程序来监听我设备上出现的新通知,但是当我使用以下语句启用设置时,我没有在设置中获取我的应用名称。我已经完成 Android developers NotificationListenerService 并添加了服务 AndroidMainfest。我通过这个 Intent:

打开设置 activity
Intent intent = new Intent("android.settings.NOTIFICATION_LISTENER_SETTINGS");

以下是我的NotificationListener class

public class NotificationListener extends NotificationListenerService {
    private final String TAG = this.getClass().getSimpleName();
    private final String Notification_Settings = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS";

    @Override
    public void onCreate() {
        super.onCreate();
        startActivity(new Intent(Notification_Settings));
    }

    @Override
    public void onNotificationPosted(StatusBarNotification sbn) {
        Bundle extras = sbn.getNotification().extras;
        String title = extras.getString("android.title");
        String text = extras.getCharSequence("android.text").toString();
        Log.i(TAG, title + " " + text);
    }

    @Override
    public IBinder onBind(Intent i) {
        return super.onBind(i);
    }
}

最后,我调用主服务 activity

Intent i = new Intent(getApplicationContext(), NotificationListener.class);
startService(i);

我不知道我错过了什么。请帮我。谢谢!

编辑:

AndroidManifest 中的服务:

<service android:name=".NotificationListener"
    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>

正如@Pawel 所指出的,我检查了清单并注意到

中的 'L'
android:permission="android.permission.BIND_NOTIFICATION_lISTENER_SERVICE">
                                                         ^

是小的。