Getting Runtime Error when trying to use Serial to communicate to Arduino

I'm trying to use Serial to communicate to an Arduino with my phone. The basic idea is to send integers to the arduino based on which it will do certain actions.

This is the code I made to test if it works

When I click the button I get this error

Error Text: 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.

I'm not quite sure what to do here. Any help/advice is appreciated.

Is there nothing that can be done about this. I'm still stuck.

By this discussion it seems like it is a Android 12 problem.

Please someone clarify.

This might be related to the same issue I'm having. Guess all we can do is wait?

Yes this will just affect folks using Android 12 and later. The code for the Serial component doesn't make direct reference to the classes in question, so I will need to dig into the Physicaloid library we use for that to see what's going on.


Thanks @ewpatton.
I don't mean to be pushy or impatient but can I know approximately how much time would it take for the fix to be in place.

Also, do let us know when that happens.

Can you check if this extension works on Android12? SerialOTG

Sorry, Build 2021-12-19 does not work.

But 2022-02-26 seems to work. Have to check it again.

Sorry, tested 2022-04-13 and 2022-02-26. They all show the same error.

BTW, sending a text message (SMS) generates the same error.

This still is not working today (2022/10/27). Can anyone help to solve this problem?
Many thanks!

What is not working?

Dear Sir:
It shows runtime error. Would you please help me solve this promblem? Many thanks!

This works for me on Android 9:

There is a small change in the latest version (debug 22-10-19), so it should work with all versions of Android incl. Android12. I don’t have access to an Android12 device, so I really want to hear that it’s working with Android12.

Dear Sir,
Wound you please do the same thing for potencimetro.aia? Or Tell us how can we fix it by ourself. Many thanks!

Im having the exact same error except im on android 13 on a google phone, does anyone know how to fix it?

Dear Sir:
Many thanks for your help. The updated version is working! However, I still have problems drawing the line. Would you please help me with this problem?
Really appreciated!

For a better test on the incoming Y value, use the IS A NUMBER block.

Dear Sir:

Many thanks for your help. I used IS A NUMBER block. The APP seems to receive two sending data at one time. The Timer interval(10ms) is half of the sending interval(20ms). Any suggestions

Really appreciated!!

Don't use an AND block for your tests.
Nest the < comparison inside the IS A NUMBER test to prevent it from running if not a number.