top of page

Amazon Device Messaging (ADM) with Xamarin.Android

Amazon Device Messaging (ADM) is the recommended method for sending push notifications to the Kindle. Unfortunately we cannot use Google Cloud Messaging (GCM) as it relies on the Google Services Framework which is not installed on the Kindle. This article will provide some direction on how to utilize ADM in your app using Xamarin.

CODE WALKTHROUGH

SERVER

Before we dive into the Xamarin code, a server needs to be setup to send the ADM push notifications. Below is an example of how to do this in .NET using PushSharp. PushSharp is available via NuGet or directly at github.com/Redth/PushSharp

**(Insert code here)**

You can obtain your client identifier (clientId) and client secret (clientSecret) from Amazon by following the instructions here developer.amazon.com/public/apis/engage/device-messaging/tech-docs/02-obtaining-adm-credentials

We will obtain the registration identifier (registrationId) in the client code, which is explained below. Once the client receives the registration identifier from Amazon, it should be stored on the server so that the server is aware of which devices are registered to receive notifications.

CLIENT – ADM Bindings Library

The Android Device Messaging Jar package, which is included in the Amazon Mobile App SDK, is required to receive push notifications. Download the Amazon Mobile App SDK here developer.amazon.com/public/resources/development-tools/sdk

Because the ADM library is a Java Jar package and not a .NET library, we must create a Xamarin Java Bindings Library project in Visual Studio or Xamarin Studio.

Locate the amazon-device-messaging-x.x.x.jar file and copy it to the “Jars” directory in your Java Bindings Library project. Verify that the Build Action of the ADM Jar is set to “InputJar”.

That’s it for the Bindings Library. You can now build your project so that it can be used as a reference.