Every time on token refresh is called when the application launched.

a94_89Chauhana94_89Chauhan USMember ✭✭
edited June 2018 in General

on token refresh call only when

App deletes Instance ID

App is restored on a new device

User uninstalls/reinstall the app

User clears app data

but On token refresh every time call when the app is Launched.

how can we one time call token refresh event when the app is installed?

any solution of that problem?

MyFirebaseIIDService :

[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);            
    }
}

AndriodMainfest.Xaml:

 <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>

Sign In or Register to comment.