The first part of my code works ok, but if I restart the app I want to check if the SIM card has been changed. There must be something fundamentally wrong with my blocks, but I don't know what. Can someone help please'
What happens, if you restart the app?
What is the serial number in your test?
Are you asking for permission?
see also the documentation App Inventor Extensions: Telephony Manager | Pura Vida Apps
Return the SIM Serial Number. In case of tablets or devices which can't act as Mobile Phone, this will be null.
Note: This block needs the permission READ_PHONE_STATE . See the example project #1 below about how to ask for this permission.
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
Yes I ask for permission. Serial No. is in the screenshot below. On the first runthrough of the code, everything works perfectly. If I restart the App, it doesn't runthrough at all.
Sorry the serial number is not in the screenshot. I changed the code. The serial no. is about 15 characters long. I can assure you that it shows ok. It's nothing to do with your extension, it's my code, but I simply don't know what I am doing wrong.
does that mean, the message "It looks like your SIM has changed..." will be displayed?
you might want to replace the else if statement by an else statement and try again
Taifun
After the first run (which works perfectly), nothing displays. I will adjust the code as suggested, and will post more screenshots then. Thank you @Taifun for your help.
@Taifun OK, I changed the elseif blocks to else. The whole App would not run through. This gave me some clue as to what was wrong. As I said in my previous posts something was wrong with my coding, so I had a look back. See screenshot.
In my initialisation blocks I put in the Checksim Procedure. Which led to....
I already had the Check sim Procedure flagged in the when permission granted block...!
The upshot of this is that after the Permission Denied ends the App, and the App is restarted, it works perfectly. However if I remove either one of the Checksim blocks, my original problem persists. TIA