Skip to content Skip to sidebar Skip to footer

Sns Mobile Push

I am currently developing an Android app in Xamarin. I am using AWS SNS Push and Google Cloud Messenger (GCM). I've been following this walkthrough pretty closely: http://docs.aws.

Solution 1:

You are mixing API's, for one side you use the new InstanceId API to get the token and in other you use the old way of receiving data with a wakefulbroadcastreceiver, replace your receiver with a derived type from GcmListenerService, something like this:

[Service (Exported = false), IntentFilter (new [] { "com.google.android.c2dm.intent.RECEIVE" })]
publicclassSignalGCMReceiver : GcmListenerService
{

    publicoverridevoidOnMessageReceived (stringfrom, Bundle data)
    {
        Console.WriteLine(data.ToString());

    }
}

And finally add the receiver on the manifest (the receiver is implemented internally by the service):

<receiverandroid:name="com.google.android.gms.gcm.GcmReceiver"android:exported="true"android:permission="com.google.android.c2dm.permission.SEND"><intent-filter><actionandroid:name="com.google.android.c2dm.intent.RECEIVE" /><actionandroid:name="com.google.android.c2dm.intent.REGISTRATION" /><categoryandroid:name="@PACKAGE_NAME@" /></intent-filter></receiver>

Post a Comment for "Sns Mobile Push"