c# - RuntimeException throwed after receiving a notification -
i implemented push notifications on c# xamarin.android project in official firebase documentation.
it possible send notifications firebase console. tried send messages c# service. device monitor says, gcm message delivered.
see android device monitor messages: http://imgur.com/a/wnov3
here's code. why happen?
androidmanifest.xml
<application android:label="myapp" android:icon="@drawable/icon"> <receiver android:name="com.google.firebase.iid.firebaseinstanceidinternalreceiver" android:exported="false" /> <receiver android:name="com.google.firebase.iid.firebaseinstanceidreceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.send"> <intent-filter> <action android:name="com.google.android.c2dm.intent.receive" /> <action android:name="com.google.android.c2dm.intent.registration" /> <action android:name="com.google.firebase.messaging_event"/> <category android:name="${applicationid}" /> </intent-filter> </receiver> <service android:name=".myfirebasemessagingservice"> <intent-filter> <action android:name="com.google.firebase.messaging_event"/> </intent-filter> </service> </application>
myfirebasemessagingservice.cs
[service] [intentfilter(new[] { "com.google.firebase.messaging_event" })] public class myfirebasemessagingservice : firebasemessagingservice { const string tag = "myfirebasemsgservice"; public myfirebasemessagingservice() { log.debug(tag, "service called"); } public override void onmessagereceived(remotemessage message) { string msg = message.getnotification().body; log.debug(tag, msg); } }
i got work manifest configuration
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.xxxxx.xxxx" android:versionname="1.0.0" android:versioncode="2"> <uses-sdk android:minsdkversion="15" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="com.google.android.c2dm.permission.receive" /> <uses-permission android:name="android.permission.wake_lock" /> <application android:icon="@drawable/icon" android:label="xx xxx"> <receiver android:name="com.google.firebase.iid.firebaseinstanceidinternalreceiver" android:exported="false" /> <receiver android:name="com.google.firebase.iid.firebaseinstanceidreceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.send"> <intent-filter> <action android:name="com.google.android.c2dm.intent.receive" /> <action android:name="com.google.android.c2dm.intent.registration" /> <category android:name="${applicationid}" /> </intent-filter> </receiver> </application> </manifest>
Comments
Post a Comment