Hello,
I am developing a Xamarin.Android application to receive notifications from Parse. But my device is not receiving notifications. Here is my code:
My AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.test">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<uses-permission android:name = "com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name = "android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name = "android.permission.INTERNET" />
<uses-permission android:name = "android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name = "android.permission.WAKE_LOCK" />
<uses-permission android:name = "android.permission.VIBRATE" />
<permission android:protectionLevel = "signature" android:name = "com.companyname.test.permission.C2D_MESSAGE" />
<uses-permission android:name = "com.goodchapp.android.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:label="test.Android" android:theme="@style/MainTheme">
<meta-data android:name="com.parse.push.gcm_sender_id"
android:value="id:xxxxxxxx" />
<service
android:name="com.parse.fcm.ParseFirebaseInstanceIdService"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service
android:name="com.parse.fcm.ParseFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<receiver
android:name="com.parse.ParsePushBroadcastReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
And my ParseApplication :
namespace test.Droid
{
[Application(Name = "com.companyname.test.ParseApplication")]
class ParseApplication : Application
{
public ParseApplication(IntPtr handle, JniHandleOwnership ownerShip)
: base(handle, ownerShip)
{
}
public override void OnCreate()
{
base.OnCreate();
ParseClient.Initialize(new ParseClient.Configuration
{
ApplicationId = "app_id",
WindowsKey = "master-key",
Server = "http://192.168.X.XXX:8080/parse/"
});
ParseUser.LogInAsync("test", "test");
ParsePush.ParsePushNotificationReceived += ParsePush.DefaultParsePushNotificationReceivedHandler;
ParseInstallation.CurrentInstallation.SaveAsync();
}
}
When I launch the application I get a field in the installation table of my parse Server.
In this entry the GCMSenderId and DeviceToken fields are empty. When I send a notification from the dashboard, I see that no one receives the notification.