Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace FCMClient
- {
- [Service]
- [IntentFilter(new[] { "com.google.firebase.INSTANCE_ID_EVENT" })]
- public class MyFirebaseIIDService : FirebaseInstanceIdService
- {
- const string TAG = "MyFirebaseIIDService";
- public override void OnTokenRefresh()
- {
- var refreshedToken = FirebaseInstanceId.Instance.Token;
- Log.Debug(TAG, "Refreshed token: " + refreshedToken);
- SendRegistrationToServer(refreshedToken);
- }
- void SendRegistrationToServer(string token)
- {
- // Add custom implementation, as needed.
- }
- }
- }
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.clastech.testpush" android:installLocation="auto">
- <uses-sdk android:minSdkVersion="15" />
- <uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
- <!--push notification-->
- <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>
- <!--push notification-->
- <application android:label="testePush.Android"></application>
- </manifest>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement