Trouble getting Permissions, TaifunTelephonyManager extension

I don't want SMS permission. I want to use the Phone Number. I will exolain a little more. I am trying to construct a QR code that will consist of 3 things, An order number, a phone number, and the users name. It will form a comma separated value that needs to be passed to a receptor App which will then parse the QR code to be usable. I am unfamilar with permissions, but have read lots about them, but when it comes to blocks I am baffled and need help. ps. In the graphics above, the procedure block is missing. Must have happened when I right clicked on the blocks.

Maybe but error shows that you have not permission to read sms.

So can you help me or not?

what happens, if you try the example project downloadable from here https://puravidaapps.com/telephonymanager.php?
Also which Android device and Android version are you using for your tests?

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

No I didn't try the project, but I will. My Phone is an LG using Android 6.0. Back shortly with result of project.

@Taifun Yep, your TM1 works fine on my phone.

@Taifun TM2 works also but the signal strength shows 0 dBm and 0 asu.

ok, fine

this might be an issue with your device? you might want to try another one

Taifun

I now adjusted my code, and it works fine on my LG, but will not work on any Samsungs. Tried on 2 no namers, worked on 1 and not the other. The ones it seems to work on apart from mine, are older ones. Any ideas? Or are permissions a nightmare in general?

what about the TM1 example project?
why don't you ask for the necessary permissions as shown in that example project?

Taifun

I use this extension and did not care at all about permission in my code.
When I install the app, I'm asked for those permissions and everything woks fine after.
Michel

@DMike Yes I'll try that.
@Taifun It was tried on 3 Samsungs, and did not work. I shared an APK of your TM1 to the owners, and found that all three were subscribers to the same telco. For some reason that telco hides the phone number. Every other detail came through but not the phone no. I cannot program against that. I guess my problem was valid but moot.

I think the only way I can work around this, is to ask the user to enter their ph. no. manually. It's fraught with danger. I did find a workaround with a check for wrong numbers, but it's clumsy. Any other suggestions?

reading the documentation could have brought you some enlightenment earlier...
https://puravidaapps.com/telephonymanager.php

Note: This is no guaranteed solution, because the phone number is not physically stored on all SIM-cards, or broadcasted from the network to the phone. This is especially true in some countries which requires physical address verification, with number assignment only happening afterwards. As workaround you always can use this solution.

Taifun

@Taifun Yes thank you for that. It is the solution I am working on now. But there is a big problem with it. And that is, if the user intentionally or unintentionally enters a wrong number then the .MessageReceived will not activate because the message is not received. It goes to whatever number the user typed in. Any ideas to circumvent that?

@Taifun I was wondering if a timer might be the answer. So after a number of seconds the message is NOT received then it could trigger the Error Message. What do you think?

sounds good
Taifun

hi @Taifun
what about getting phone numbers from the dual sim phones ???

For dual SIM cards the preferred SIM details are returned

for the IMEI you can try the Dual SIM IMEI Viewer Extension by Sakis K
however see also

Taifun

Thank you @Taifun