my app is not listed in notification access setting screen...
我的应用未列在通知访问设置屏幕中...
i added this permission BIND_NOTIFICATION_LISTENER_SERVICE in manifest.xml
我在manifest.xml中添加了此权限BIND_NOTIFICATION_LISTENER_SERVICE
opening notification access setting screen by calling this intent startActivity(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"));
通过调用此intent startActivity打开通知访问设置屏幕(new Intent(“android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS”));
anyone implemented thanks...
任何人实施感谢...
1 个解决方案
#1
0
I had this problem as well and I made the mistake of putting the service tag outside the application tag like this:
我也遇到了这个问题,我错误地将服务标签放在应用程序标签之外,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<service android:name=".TELNotificationListening"
android:label="@string/service_name"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
I fixed this problem by putting the service tag inside the application tag like this:
我通过将service标记放在应用程序标记中来解决此问题,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".TELNotificationListening"
android:label="@string/service_name"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
</application>
You need to create a class that extends NotificationListenerService in my case I named it TELNotificationListening. You put the name of your class in android:name="" in the service tag.
您需要创建一个扩展NotificationListenerService的类,我将其命名为TELNotificationListening。您将类的名称放在服务标记中的android:name =“”中。
In order to extend NotificationListenerService your minimum SDK has to be set to 21.
为了扩展NotificationListenerService,您的最小SDK必须设置为21。
Once you extend NotificationListenerService you can then override it's method!
扩展NotificationListenerService后,您可以覆盖它的方法!
#1
0
I had this problem as well and I made the mistake of putting the service tag outside the application tag like this:
我也遇到了这个问题,我错误地将服务标签放在应用程序标签之外,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<service android:name=".TELNotificationListening"
android:label="@string/service_name"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
I fixed this problem by putting the service tag inside the application tag like this:
我通过将service标记放在应用程序标记中来解决此问题,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".TELNotificationListening"
android:label="@string/service_name"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
</application>
You need to create a class that extends NotificationListenerService in my case I named it TELNotificationListening. You put the name of your class in android:name="" in the service tag.
您需要创建一个扩展NotificationListenerService的类,我将其命名为TELNotificationListening。您将类的名称放在服务标记中的android:name =“”中。
In order to extend NotificationListenerService your minimum SDK has to be set to 21.
为了扩展NotificationListenerService,您的最小SDK必须设置为21。
Once you extend NotificationListenerService you can then override it's method!
扩展NotificationListenerService后,您可以覆盖它的方法!