Android Question ADM

cooperlegend

Active Member
Licensed User
Longtime User
I am currently liaising with DonManfred to create a solution for Amazon Device Messaging.

Running his example code on my own project is currently not getting a Registrationid back

B4X:
Logger connected to:  Amazon AFTT
--------- beginning of main
--------- beginning of system
*** Service (starter) Create ***
Using FileProvider? false
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Skipped
Skipped
Skipped
** Activity (main) Resume **
*** Service (amazonmessaging) Create ***
** Service (amazonmessaging) Start **
(Intent) Intent { cmp=####.####/.amazonmessaging }
no extras
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
** Service (firebasemessaging) Start **
ADM V2 supported on this Device!
ADM 2nd check: ADM supported on this Device!
RegistrationId = null
RegistrationId = null
** Service (firebasemessaging) Start **
** Service (firebasemessaging) Start **
** Service (firebasemessaging) Start **
java.lang.RuntimeException: Unable to instantiate receiver anywheresoftware.b4a.objects.AmazonNotificationsService.amazonmessaging$amazonmessaging_BR: java.lang.ClassNotFoundException: Didn't find class "anywheresoftware.b4a.objects.AmazonNotificationsService.amazonmessaging$amazonmessaging_BR" on path: DexPathList[[zip file "/data/app/leagueapplive.sapphire-2/base.apk", zip file "/system/priv-app/DeviceMessagingAndroidSDK/DeviceMessagingAndroidSDK.apk", zip file "/system/priv-app/MetricsApi/MetricsApi.apk", zip file "/system/priv-app/com.amazon.dp.logger/com.amazon.dp.logger.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
    at android.app.ActivityThread.handleReceiver(ActivityThread.java:2750)
    at android.app.ActivityThread.access$1700(ActivityThread.java:160)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1398)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5597)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:984)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: java.lang.ClassNotFoundException: Didn't find class "anywheresoftware.b4a.objects.AmazonNotificationsService.amazonmessaging$amazonmessaging_BR" on path: DexPathList[[zip file "/data/app/leagueapplive.sapphire-2/base.apk", zip file "/system/priv-app/DeviceMessagingAndroidSDK/DeviceMessagingAndroidSDK.apk", zip file "/system/priv-app/MetricsApi/MetricsApi.apk", zip file "/system/priv-app/com.amazon.dp.logger/com.amazon.dp.logger.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    at android.app.ActivityThread.handleReceiver(ActivityThread.java:2745)
    ... 9 more
    Suppressed: java.lang.ClassNotFoundException: anywheresoftware.b4a.objects.AmazonNotificationsService.amazonmessaging$amazonmessaging_BR
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 11 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
--------- beginning of crash
 

cooperlegend

Active Member
Licensed User
Longtime User
I believe the Amazon part is all set up fine and I have my API key etc.

I missed out adding the api_key.txt file into my project

I now get

B4X:
Logger connected to:  Amazon AFTT
--------- beginning of system
--------- beginning of crash
--------- beginning of main
*** Service (starter) Create ***
Using FileProvider? false
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Skipped
Skipped
Skipped
** Activity (main) Resume **
*** Service (amazonmessaging) Create ***
** Service (amazonmessaging) Start **
(Intent) Intent { cmp=######.#####/.amazonmessaging }
no extras
*** Service (firebasemessaging) Create ***
** Service (firebasemessaging) Start **
ADM V2 supported on this Device!
ADM 2nd check: ADM supported on this Device!
RegistrationId = amzn1.adm-registration.v3.Y29tLmFtYXpvbi5EZXZpY2VNZXNzYWdpbmcuUmVnaXN0cmF0aW9uSWRFbmNyeXB0aW9uS2V5ITEhTzJrTlRNN0FRb0dzQzVBdFVZZHljZWxGdXFkL0tCcHFSRVp5dmFCOHpaWmZvczNWZTlTUHN5b2crbHphTUxUbzJUQmtGV2JIczdSQVA5aUdnaWVONXpyNytKa2tsNStnZG13SFhMQ1ZNbVl6L0QwWVFNZ0VGa3ZnMFBhT05ER0hNVk5yaytSR0tUKys4OTkvUkNaazRLWW9Fd0NJTVhHM3NDdGltQnJ5cW9wZndWWUdSZVJDbFlNWExTZEk0V2F0RDh2YVFkNDRkMThCRy8zY3hZc21TY2xyeHFvcGNnVytrSm4wYWsyaHU4bUJrcmR6bVVodU8xSEZSWlJLcTVTQ3pvc0pkQStvU2xOb3NCSk
RegistrationId = amzn1.adm-registration.v3.Y29tLmFtYXpvbi5EZXZpY2VNZXNzYWdpbmcuUmVnaXN0cmF0aW9uSWRFbmNyeXB0aW9uS2V5ITEhTzJrTlRNN0FRb0dzQzVBdFVZZHljZWxGdXFkL0tCcHFSRVp5dmFCOHpaWmZvczNWZTlTUHN5b2crbHphTUxUbzJUQmtGV2JIczdSQVA5aUdnaWVONXpyNytKa2tsNStnZG13SFhMQ1ZNbVl6L0QwWVFNZ0VGa3ZnMFBhT05ER0hNVk5yaytSR0tUKys4OTkvUkNaazRLWW9Fd0NJTVhHM3NDdGltQnJ5cW9wZndWWUdSZVJDbFlNWExTZEk0V2F0RDh2YVFkNDRkMThCRy8zY3hZc21TY2xyeHFvcGNnVytrSm4wYWsyaHU4bUJrcmR6bVVodU8xSEZSWlJLcTVTQ3pvc0pkQStvU2xOb3NCSk
** Service (firebasemessaging) Start **
** Service (firebasemessaging) Start **
** Service (firebasemessaging) Start **
** Service (firebasemessaging) Start **
java.lang.RuntimeException: Unable to instantiate receiver anywheresoftware.b4a.objects.AmazonNotificationsService.amazonmessaging$amazonmessaging_BR: java.lang.ClassNotFoundException: Didn't find class "anywheresoftware.b4a.objects.AmazonNotificationsService.amazonmessaging$amazonmessaging_BR" on path: DexPathList[[zip file "/data/app/leagueapplive.sapphire-1/base.apk", zip file "/system/priv-app/DeviceMessagingAndroidSDK/DeviceMessagingAndroidSDK.apk", zip file "/system/priv-app/MetricsApi/MetricsApi.apk", zip file "/system/priv-app/com.amazon.dp.logger/com.amazon.dp.logger.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
    at android.app.ActivityThread.handleReceiver(ActivityThread.java:2750)
    at android.app.ActivityThread.access$1700(ActivityThread.java:160)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1398)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5597)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:984)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: java.lang.ClassNotFoundException: Didn't find class "anywheresoftware.b4a.objects.AmazonNotificationsService.amazonmessaging$amazonmessaging_BR" on path: DexPathList[[zip file "/data/app/leagueapplive.sapphire-1/base.apk", zip file "/system/priv-app/DeviceMessagingAndroidSDK/DeviceMessagingAndroidSDK.apk", zip file "/system/priv-app/MetricsApi/MetricsApi.apk", zip file "/system/priv-app/com.amazon.dp.logger/com.amazon.dp.logger.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    at android.app.ActivityThread.handleReceiver(ActivityThread.java:2745)
    ... 9 more
    Suppressed: java.lang.ClassNotFoundException: anywheresoftware.b4a.objects.AmazonNotificationsService.amazonmessaging$amazonmessaging_BR
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 11 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
looks good so far now ;-)

Issue is still open
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
try this new example. Make sure to add your key and change packagename.

At least now you should NOT get any crash.

The example has code to send the registrationid to a server. In the example it is my server. I just log all incoming requests. Nothing is really stored in db or so...
You now can try to send a message using okhttputils2 to this registrationId.

It can happen that the message does not arrive. Or it does and crash the app. We need to test now what happens. Ideally we would get some LOGoutput with - hopefuly - helpful infos ;-)

PD: Next time please give the Threadtitle a more suitable meaning, not only ADM.
I suggested you to PREFIX the Threadtitle with [ADM] and not to only use ADM. The threadtitle should summarize the problem.
For ex.: [ADM] Problem setting up that thing
 

Attachments

  • ADMEx.zip
    10.7 KB · Views: 331
  • AmazonDeviceMessagingV0.03.zip
    17.1 KB · Views: 329
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…