Check for access to notifications using NotificationListenerService

后端 未结 3 541
说谎
说谎 2020-11-30 22:28

I\'m using the >=4.3 NotificationListenerService to access notifications. On the first start, my app takes the user to the \"Access Notifications\" system panel

3条回答
  •  温柔的废话
    2020-11-30 23:07

    Works well with slightly modified @Damians answer

    public class NotifyListener extends NotificationListenerService{    
            public static boolean listnerConnected = false;
        @Override
            public IBinder onBind(Intent intent) {
                Log.d(name,"onBind Called");
                listnerConnected = true;
                return super.onBind(intent);
        }   
    
            @Override
            public void onDestroy()
            {       
                super.onDestroy();        
                Log.e("destroy", "called");
                listnerConnected = false;
    
            }
    }
    

提交回复
热议问题