Тестирование TransitionAPI всегда приводит к завершению широковещательной передачи: result = 0 - PullRequest
0 голосов
/ 17 октября 2019

В настоящее время я пытаюсь протестировать код API Google Transition, и у меня возникают проблемы с трансляцией на эмулируемое устройство в Android Studio. Я использую

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

иЯ получаю обратно: Broadcast completed: result=0

мой манифест настроен на:

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

Любая помощь будет оценена

РЕДАКТИРОВАТЬ : Итак, у меня есть:

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)

            }
        }
    }

И когда я запускаю команду, я получаю

onRecieve в журналах - однако на самом деле она все еще не обновляет действие

1 Ответ

0 голосов
/ 18 октября 2019

Забыл перезагрузить устройство

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

Теперь это работает

...