codelab-activity_transitionapi icon indicating copy to clipboard operation
codelab-activity_transitionapi copied to clipboard

Application terminated or no activity reported on Android 13

Open rapa4362 opened this issue 2 years ago • 2 comments

I did no changes in the code, compiled, ran on Samsung with Android 13, application was terminated with following error, adding FLAG_IMMUTABLE to PendingIntent.getBroadcast(MainActivity.this, 0, intent, 0) eliminates the exception, but no activity is reported

FATAL EXCEPTION: main Process: com.google.example.android.basicactivityrecognitiontransitionsample, PID: 21094 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.example.android.basicactivityrecognitiontransitionsample/com.google.example.android.basicactivityrecognitiontransitionsample.MainActivity}: java.lang.IllegalArgumentException: com.google.example.android.basicactivityrecognitiontransitionsample: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.

rapa4362 avatar Feb 15 '23 08:02 rapa4362

+1 . This can be solved by adding PendingIntent.FLAG_UPDATE_CURRENT| PendingIntent.FLAG_MUTABLE as last parameter while creating pendingIntent

sathvik87 avatar Mar 01 '23 19:03 sathvik87

@sathvik87 I try it but it still not work, in android 13 it only detect STILL and WALKING activity, other activity not working. Do you have other solution? @rapa4362 Did you resolve it?

binhbk230 avatar Jun 06 '23 15:06 binhbk230