Manager not setting mutability in Pending Intent

Supporting 4.1 and up
Post Reply
mrdale1958
Fresh meat
Posts: 2
Joined: Mon Apr 25, 2016 10:27 pm
Contact:

Manager not setting mutability in Pending Intent

Post by mrdale1958 »

I followed all the instructions for setting up an Android project but when I try to run I get a crash in the vicinity of the Manager.initialize() call which results in the following stack trace. I have not been able to arm wrestle Android Studio into letting me build for version 30 to see if that fixes it but since my ultimate target is 34 I doubt I will be satisfied with that solution.

FATAL EXCEPTION: main
Process: com.example.phidgettestjava, PID: 11646
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.phidgettestjava/com.example.phidgettestjava.MainActivity}: java.lang.IllegalArgumentException: com.example.phidgettestjava: 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.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4164)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4322)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8913)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Caused by: java.lang.IllegalArgumentException: com.example.phidgettestjava: 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.
at android.app.PendingIntent.checkPendingIntent(PendingIntent.java:435)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:748)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:735)
at com.phidget22.usb.Manager.Initialize(Manager.java:73)
at com.example.phidgettestjava.MainActivity.onCreate(MainActivity.java:111)
at android.app.Activity.performCreate(Activity.java:8960)
at android.app.Activity.performCreate(Activity.java:8929)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4146)
... 12 more
User avatar
Patrick
Lead Developer
Posts: 616
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Manager not setting mutability in Pending Intent

Post by Patrick »

Hi,

We have released a fix for this issue, let us know if the latest Android library release is working for you. The fix is part of phidget22usb.jar

-Patrick
Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests