11-30-2012 11:58 AM
Hi guys
I'm developing an app and I'm facing some problems.
The app needs to read SIM data to display info depending on the SIM's country. The first thing it does after opening is read the SIM; if no SIM is detected an error is displayed, if it can be read the app displays a list. I'll go into more detail.
I have added in the bar-descriptor the "read_cellular_data" permission. When the app opens for the first time, it asks the user for permission, this is normal. After the user presses accept, the screen remains black. Minimizing the app only makes the splash screen visible. You can only close the app.
After opening the app for the second+ time, the app works normally.
Also, when I ask for the SIM state using "SimCardInfo().state();" I get "NotDetected" if there is no SIM and if the app has no permission. I'd like to know how to make a difference between those 2.
My theory is that I need to check for permission, but i cannot find any info about permissions. All I found is the following pages:
The App permissions page, which does not describe how to check for permissions
and this forum post, which is not for BB10
Any help/hints/pointers would be greatly appreciated.
Pepe
Solved! Go to Solution.
12-01-2012 01:19 PM
I don't think this is right forum to ask.
12-03-2012 11:54 AM
... but it's a BB10 native related question.
Which would be the right forum?
12-03-2012 12:02 PM
I am not aware of function SimCardInfo() in Native environment. Is there one?
12-03-2012 12:17 PM
Yes, it's here:
https://developer.blackberry.com/cascades/referenc
But I can't find any info on checking permissions.
12-03-2012 12:24 PM
Wow.. sorry missed that. Though can't answer your question now. -(
12-11-2012 04:16 AM
There is no permission read_cellular_data. It is not on the App permissions page you posted. And it is not in the bar-descriptor.xml.
12-11-2012 09:54 AM
I've seen that some permissions are not documented (can´t remember right now another example).
But in the SimCardInfo.hpp, you can find this:
/*!
* @brief Retrieves the unique identifier for the country where the SIM card's home network
* is located.
*
* @details The mobile country code (MCC) is composed of 3 or 4 decimal digits. For further
* details about the structure of the MCC, see ITU-T recommendation E.212.
*
* @return The country code of the SIM card's home network encoded as a string or an empty
* string if the caller does not have sufficient permission or the SIM card's state is not
* @c SimCardState::Ready.
*
* @permissions The application must have the @c read_cellular_data permission to access this method.
*
*/
QString mobileCountryCode() const;
The app does ask for permission when first opened, and without it, I cannot read the SIM, so the permission is functional.
I was told through e-mail by a Developer Evangelist that for now there is no way to check/modify permissions.
My problem was that the app attempted to read SIM data as it opened, while the permission was asked only on the first time the app was opened, and once you accepted/rejected, the app would stay on the splash screen.
My workaround was to present a Welcome screen only the first time the app is opened, so no SIM data would be read while the permission is asked.
Cheers!
Pepe
12-11-2012 10:10 AM
That is interesting. It seems that the documentation of the source code differs from the online API documentation. In the online documentation the permission value is not mentioned.
We also want to check permissions because our app will not work if permissions are denied. Hopefully, this feature comes with one of the next releases of the SDK.
12-11-2012 10:20 AM
Supposedly, the new SDK will be out today.
They are still working on those APIs, so I think I'll ask the user which country they are in instead of reading the SIM :/
Too bad, lets wait for the new SDK, then.