Search code examples
androidkotlingoogle-play-servicesadb

Testing TransitionAPI always results in Broadcast completed: result=0


I am currently trying to test my Google Transition API code and I've been having issues broadcasting to the emulated device in android studio, i'm running

adb shell am broadcast -a com.google.gservices.intent.action.GSERVICES_OVERRIDE -e 'location:mock_activity_type' 'WALKING'

and I get back: Broadcast completed: result=0

my manifest is set to:

<receiver android:name=".TransitionRecognitionReceiver" android:enabled="true" android:exported="true">
  <intent-filter>
       <action android:name="transitionrecognitionapp.TRANSITION_RECOGNITION" />
       <action android:name="com.google.gservices.intent.action.GSERVICES_OVERRIDE"/>`
  </intent-filter>
</receiver>

Any help would be appreciated

EDIT: So I have:

override fun onReceive(context: Context?, intent: Intent?) {
        mContext = context!!

        Log.d(TAG, "onReceive")

        if (ActivityTransitionResult.hasResult(intent)) {
            var result = ActivityTransitionResult.extractResult(intent)
            if (result != null) {
                processTransitionResult(result)

            }
        }
    }

And when I run the command I get

onRecieve in the logs - however it still doesn't actually be updating the activity


Solution

  • Forgot to restart the device

    adb shell ps -A | grep com.google.android.gms.persistent | awk '{print $2}' | xargs adb shell kill'

    This works now