Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. namespace FCMClient
  2. {
  3. [Service]
  4. [IntentFilter(new[] { "com.google.firebase.INSTANCE_ID_EVENT" })]
  5. public class MyFirebaseIIDService : FirebaseInstanceIdService
  6. {
  7. const string TAG = "MyFirebaseIIDService";
  8. public override void OnTokenRefresh()
  9. {
  10. var refreshedToken = FirebaseInstanceId.Instance.Token;
  11. Log.Debug(TAG, "Refreshed token: " + refreshedToken);
  12. SendRegistrationToServer(refreshedToken);
  13. }
  14. void SendRegistrationToServer(string token)
  15. {
  16. // Add custom implementation, as needed.
  17. }
  18. }
  19. }
  20.  
  21. <?xml version="1.0" encoding="utf-8"?>
  22. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  23. package="com.clastech.testpush" android:installLocation="auto">
  24. <uses-sdk android:minSdkVersion="15" />
  25. <uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
  26. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  27.  
  28. <!--push notification-->
  29. <receiver
  30. android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
  31. android:exported="false" />
  32. <receiver
  33. android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
  34. android:exported="true"
  35. android:permission="com.google.android.c2dm.permission.SEND">
  36. <intent-filter>
  37. <action android:name="com.google.android.c2dm.intent.RECEIVE" />
  38. <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
  39. <category android:name="${applicationId}" />
  40. </intent-filter>
  41. </receiver>
  42. <!--push notification-->
  43. <application android:label="testePush.Android"></application>
  44. </manifest>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement