Forum Xamarin Xamarin.Android

Has anyone tested OnTokenRefresh () in their own InstanceIDListenerService?

I have tried this:

{sdkPath}\sdk\platform-tools\adb.exe shell am startservice -a --es "CMD" "RST" -n {packagename}/{namespace}.services.IIDListenerService

I have not been able to test fire the OnTokenRefresh () in my InstanceIDListenerService.

Has anyone got a way to do this?


  • NielsCupNielsCup NLMember ✭✭✭

    I am also interested in this, I get the following error message: Error: Not found; no service started.

  • GavinHinchleyGavinHinchley CAUniversity

    Yes, I have been able to use this adb method to test OnTokenRefresh(). I was also getting the 'Error: Not Found' originally as well.

    In order to identify your InstanceIDListenerService, you must refer to the generated Java namespace and not the C# namespace.

    Build the Xamarin project and then locate the generated file acw-map.txt (I found this file in ./Droid/obj/Debug path). Search for the name of your InstanceIDListenerService class in this file and you should find an entry that maps your C# namespace to generated Java namespace.

    In my file, the entry looks like this:


    I then identified the service class in the adb command as: md524bd30974f96327cfe6bf621c3da6997.MyInstanceIDListenerService

    and used info from this stackoverflow to do the rest:

Sign In or Register to comment.