Notification Listener for 3rd Party app

Check app permissions:

Iā€™ve enabled it but still getting same error. and this is not the section of Special notification access. & in the section app permission there is no permissions and Not required because that first similar app does not have any permission here.
Notification Access

hi @Ken we are still not getting permission

I believe this line is wrong.
This should be the name of your service.

If this is truly the name of your service you should change the name because it may cause a conflict with the actual ā€œNotificationListenerServiceā€

1 Like

okk just trying it by changing. Changed Name

1 Like

When trying to GetNotificationUsing.PackageName Showing Error
Attempt to invoke virtual method ā€˜java.lang.stringorg.json.JSONArray.toString()ā€™ on a null object reference

I donā€™t have your code but you could try something like:

If( blahblahblah != null){
//do something
}

1 Like

maybe this is because empty stringā€¦ this is not the only problem. main is Bind.Notification Permission.
Now Iā€™m tired going to sleep Good Night/Morning
will share code here. then Challenge will be OpenSourceā€¦

1 Like

Share the code in a PM with @Ken. When you find a solution, just post it here. Some may find this post useful in the future.

2 Likes

Please Give it try if Possible @Ken @Taifun @hammerhai @vknow360
Now Challenge is OpenSource
Here is Test AIA:NotificationReader.aia (11.3 KB)
JAVA Source Code: NotificationListener.java (5.6 KB)
Also we have to Modify Manifest (Available in above post) using Android Studio Editor Then we able to register app in Special Notification Access Permission.

Here Is Github Repository And Details for this Extension :


Blocks we Got using this:

4 Likes

What is your test result?

1 Like
  1. Android is Denied to give permission :
    BIND_NOTIFICATION_LISTENER_SERVICE
  2. We are able to get Notification access by adding service in manifest
  3. when we call .GetNotificationByPackageName it showing Error:
    Attempt to invoke virtual method ā€˜java.lang.stringorg.json.JSONArray.toString()ā€™ on a null object reference
  4. GetAllNotification Block returning Empty result may be because of permission

Iā€™m taking a look into this result from the source that youā€™ve published.

To make updating your source easier from outsiders, create a GitHub Repo from github.com if youā€™d like. This will clear code up on the community so we donā€™t have to publish a reply when we update your source.

3 Likes

Here Is Github Repository And Details for this Extension :


Contribute here and give it a try

2 Likes

Hi,
I just saw your NotificationListener project and it seems very interesting. I looked at your code and tested a few things, but yes, it has an authorization problem with Android.
I would love to help you find the problem since I am looking for exactly this feature.
Would you have possibly found a modification so that it works since your last message 2 monthes ago?

2 Likes

you want to modify manifest by using another tool Android Studio Editor v1.3.1 Potable

then you can get permission

problem mentioned here

@akshay_gadekar Because people seem to really want this, Iā€™ve dug in a little more and found notification-listener-service-example/README.md at master Ā· Chagall/notification-listener-service-example Ā· GitHub. You were right for the service, just not the code. Iā€™m going to download your java file from GitHub and add this, if I get anywhere, I will let you know.

Use:

public class NotificationListenerExampleService extends NotificationListenerService {
  
    @Override
    public IBinder onBind(Intent intent) {
        return super.onBind(intent);
    }
  
    @Override
    public void onNotificationPosted(StatusBarNotification sbn){
      // Implement what you want here
    }

    @Override
    public void onNotificationRemoved(StatusBarNotification sbn){
      // Implement what you want here
    }
  }

Nvm, Iā€™ve taken a second look and you already have it. Iā€™ll still try though and make necessary edits as neededā€¦

Edit

Iā€™ve made changes to the source and I think Iā€™ve made some sort of progress. When allowing the Notification Access permission, the app crashes and unbinds the listener (or it just doesnā€™t work) and holds the app in a frozen like state where whenever you get notifications, the event is still not executed by the OS.

Iā€™ve looked at the logs and thereā€™s no way for me to understand the errors, because there are none. It gives me an error like Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnunHandledKeyEventListenerWrapper> and I looked it up, but Iā€™m not entirely sure what it means.

7 Likes

This sayā€™s all.

1 Like

Thanks Mika, but do I have to add the library?

1 Like

You canā€™t use libs which depence on ā€œAndroid Xā€.

Use this:
https://developer.android.com/reference/android/support/v4/view/ViewCompat

import android.support.v4.view.ViewCompat;

2 Likes