android / codelab-activity_transitionapi

Codelab walks you through tracking activity transition changes (start/stop run, walk, idle, drive, etc.).
Other
25 stars 11 forks source link

TransitionsReceiver Intent extras is always null #26

Open MaksimDmitriev opened 1 year ago

MaksimDmitriev commented 1 year ago

I ran the complete debug variant of the app on Galaxy Z Flip 3 5G (Android 12) and Xiaomi Redmi K40 (Android 12). After walking for a 10 metres or so, TransitionsReceiver.onReceive was called. I assume it was walking activity detected. But intent.getExtras() was null. Hence, ActivityTransitionResult.hasResult(intent) returned false, and no information was printed.

I tried 31 and 32 for targetSdkVersion and compileSdkVersion

What is the issue?

varun7952 commented 1 year ago

Can you show us your code

MaksimDmitriev commented 1 year ago

the bug was fixed by using the MUTABLE PendingIntent flag, not the IMMUTABLE one

hannahaponenko commented 1 year ago

Thank you @MaksimDmitriev - saved me a lot of heartache.