locked
Has anyone tested OnTokenRefresh () in their own InstanceIDListenerService? RRS feed

  • Question

  • User91547 posted

    I have tried this:

    {sdkPath}\sdk\platform-tools\adb.exe shell am startservice -a com.google.android.gms.iid.InstanceID --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?

    Friday, October 16, 2015 4:21 PM

All replies

  • User32870 posted

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

    Monday, November 23, 2015 9:26 AM
  • User173354 posted

    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:

    MyProj.Droid.MyInstanceIDListenerService,MyProj.Droid;md524bd30974f96327cfe6bf621c3da6997.MyInstanceIDListenerService

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

    and used info from this stackoverflow to do the rest:

    http://stackoverflow.com/questions/30637347/when-will-instanceidlistenerservice-be-called-and-how-to-test-it

    Friday, July 15, 2016 4:01 PM