Hi,
I have an optional feature in my app to listen to Notifications, I have used NotificationListener for that, which should be enabled only on API >=19 by the user and this option won't appear on API < 19. But when I run my app on android 4 (API < 19), I am getting an error, which is same on NotificationListner example code, the same error appears in my app. However, the app has no access to listen to notifications from notification listener settings of Android OS.
Is there any workaround to disable loading process_globals of notificationListener on API < 19? The process_globals of each service and activity are loaded on app launch. I am using minSDK version of 11 and target Sdk as 29.
I have an optional feature in my app to listen to Notifications, I have used NotificationListener for that, which should be enabled only on API >=19 by the user and this option won't appear on API < 19. But when I run my app on android 4 (API < 19), I am getting an error, which is same on NotificationListner example code, the same error appears in my app. However, the app has no access to listen to notifications from notification listener settings of Android OS.
Log:
java.lang.RuntimeException: Unable to create service b4a.notificationlistener.starter: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2263)
at android.app.ActivityThread.access$1600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at b4a.notificationlistener.starter.onCreate(starter.java:39)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2253)
... 10 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at b4a.notificationlistener.starter.onCreate(starter.java:37)
... 11 more
Caused by: java.lang.NoClassDefFoundError: b4a.notificationlistener.notificationservice
at b4a.notificationlistener.main.initializeProcessGlobals(main.java:419)
... 14 more
Is there any workaround to disable loading process_globals of notificationListener on API < 19? The process_globals of each service and activity are loaded on app launch. I am using minSDK version of 11 and target Sdk as 29.