Amazon Device Messaging
Please can we have a solution for B4A to use Amazon Device Messaging :) Amazon Device Messaging I am happy to donate to this development if necessary John
I am developing a wrapper for AmazonDeviceMessaging (ADM) and i would like to ask for help from you if you are using Aamazon Devices and want to test the library.
Q: On which Amazon devices is ADM supported?
ADM is supported on Fire phone, Fire TV, and Fire tablets, except for Kindle Fire (1st Generation). For ADM notifications to appear on Fire TV, you must implement the Fire TV Notifications.
The library is not finished as of now. I need comments (bugreports, logs) from someone who uses it on a Amazondevice ?
To use it you need to register your app on Amazons console.
You need to place your apikey in the api_key.txt file in the assets in your project.After you Obtain Credentials to use Amazon Device Messaging (ADM) and set it up in your development environment, integrate ADM with your app. See Overview of ADM for a high-level overview of the process of adopting ADM in your app and server code.
Maybe you need to use
B4X:
#DebuggerForceStandardAssets: true
Please note the Manifestchanges in the Example. Also note the additional Service which name must be AmazonMessaging.
Ok, here we go.
Note that i do expect it to crash on the firestick at some point ? ?
Basically it is this code in the "AmazonMessaging" Service (adapted from FirebaseMessaging ;-) )
B4X:
Public Sub Register
If adm.IS_ADM_AVAILABLE Then
If adm.IS_ADM_V2 Then
Log("ADM V2 supported on this Device!")
Else
Log("ADM supported on this Device!")
End If
StartRegisster
Else
Log("ADM not supported on this Device!")
End If
End Sub
private Sub StartRegisster()
If adm.Supported Then
Log("ADM 2nd check: ADM supported on this Device!")
If adm.RegistrationId = Null Then
adm.startRegister ' At latest i expect it to crash here if we came such far
Else
Log($"RegistrationId = ${adm.RegistrationId}"$)
End If
End If
End Sub
I do expect it to crash at the startRegister if we came so far...
Note the resources added in the manifest.
B4X:
CreateResource(values, strings.xml,
<resources>
<string name="app_name">ADMMessenger</string>
<string name="menu_settings">Settings</string>
<string name="title_activity_main">MainActivity</string>
<string name="json_data_msg_key">message</string>
<string name="json_data_time_key">timeStamp</string>
<string name="json_data_consolidation_key">collapse_key</string>
<string name="intent_msg_action">com.amazon.sample.admmessenger.ON_MESSAGE</string>
<string name="intent_msg_category">com.amazon.sample.admmessenger.MSG_CATEGORY</string>
<string name="server_address">http://webhook.basic4android.de/</string>
<string name="server_port">80</string>
</resources>)
for your test you can leave this settings so - hopefully
For the real usecase you should replace it with your own server. This is the website which do get any new user-token to be able to track them and - later - send a message to this device.
Hopefully you get some error or other things in the LOG. Good luck ?
Also note that the library is not finished as of now. I need to get some errorreports and logs to see more.
Attachments
Last edited: