I have an application, that can be successfully setup as Device Owner on devices up to Android 12 via QR code and now I add two activity like this link for android 12: Android 12 Device Owner Provisioning. and the device owner setup is completed but when I want to run my app I have this error:(and I don't have any pending intent)
java.lang.IllegalArgumentException: io.phoenixdev.afw.emm: 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.```
this is because one or a few of your PendingIntent is created without the Mutability flag. Can you check if you are passing the Mutability flag(either FLAG_MUTABLE or FLAG_IMMUTABLE)? In case you are not modifying the pending intent once created, I would recommend adding FLAG_IMMUTABLE.
Here is the method I use to get flags for Pending Intent so that you don't have to do Android 12 checks everywhere.
Simply call getPendingIntentFlag(false) for immutable intents like this
This way either android 12 or not, you need not worry about this flag.