Android Question ADM

cooperlegend

Active Member
Licensed 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
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
 

DonManfred

Expert
Licensed User
RegistrationId = amzn1.adm-registration.v3.Y29tLmFtYXpvbi5EZXZpY2VNZXNzYWdpbmcuUmVnaXN0cmF0aW9uSWRFbmNyeXB0aW9uS2V5ITEhTzJrTlRNN0FRb0dzQzVBdFVZZHljZWxGdXFkL0tCcHFSRVp5dmFCOHpaWmZvczNWZTlTUHN5b2crbHphTUxUbzJUQmtGV2JIczdSQVA5aUdnaWVONXpyNytKa2tsNStnZG13SFhMQ1ZNbVl6L0QwWVFNZ0VGa3ZnMFBhT05ER0hNVk5yaytSR0tUKys4OTkvUkNaazRLWW9Fd0NJTVhHM3NDdGltQnJ5cW9wZndWWUdSZVJDbFlNWExTZEk0V2F0RDh2YVFkNDRkMThCRy8zY3hZc21TY2xyeHFvcGNnVytrSm4wYWsyaHU4bUJrcmR6bVVodU8xSEZSWlJLcTVTQ3pvc0pkQStvU2xOb3NCSk
looks good so far now ;-)

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]]
Issue is still open
 

DonManfred

Expert
Licensed 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.
======================================
24.03.2020 18:55:22: action=register
24.03.2020 18:55:22: token=amzn1.adm-registration.v3.Y29tLmFtYXpvbi5EZXZpY2VNZXNzYWdpbmcuUmVnaXN0cmF0aW9uSWRFbmNyeXB0aW9uS2V5ITEhZzdWQk5UWktrSGZXbWxzT2U2VTI0K3ZPWVdDYXk5USs4WHNLblFlYWZPV1A3UFV1emdqUWhTVXdOMVJab1VpT1gyNyttZDROSEVEQTFFWktGVHF1SU1QZlpvcFNHbWVGRmJheTk3OHRUVVRUOGJ6WEFjMXY1YzRGV21ScitNNUlybE41akVKSmZTdEFBOE14dmNZRU1pSEVRaUV3UUVObFJPVzQ3K3I0cWIwd0svSngwK2tYcXlkZFNoeFlRUDRVakdqdnJWYm9Xd2xMT2ZsTStMUzFNRmo2ZHlnZ0ZjUEFncUF1cXE1N0ovdGpobWRxMHYyaDBOTVdXTDdxbTVoSEYyeEFFdTVRMlhOZkRYOSsyak53MlE0R2F2U3MvSkhVMlpFY3Y2dFV0QkZJM1BUSXB3MjBEZmdjY0lZMnQzNVlobnQ1R21OS0N1VGVjNWxycmVqeTZoV2dMRG1hSlJPNGtRaTlkeUMyYUFFPSFxalJIMnllWUJWNExEZmp1N2w1Tm1nPT0
24.03.2020 18:55:22: deviceID=DonManfred
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

Last edited:
Top