android - Can I start NotificationListenerService in code explicitly rather than it be started for me by the OS? -
i have class derived notificationlistenerservice , getting created , started me automatically when app starts. lazily start service later activity , not have start automatically when app starts. possible this? manifest is:
<service android:name=".mynotificationlistener" 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>
note before notificationlistenerservice can used user has grant app notification access via setting. if intent filter removed manifest app not appear in settings , user unable grant permission, without permission service can't started. seems os needs intent filter there before display app in settings.
update: documentation bind_notification_listener_service says:
must required notificationlistenerservice, ensure system can bind it.
so guess means os can start notificationlistenerservice , nobody else can.
yes. create intent service call startservice.
Comments
Post a Comment