Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
ankur_siwach
Posts: 148
Registered: ‎09-28-2012
My Device: Blackberry Developer
Accepted Solution

How to check app permission which is declared in bar-descriptor.xml file

How do i check programitcally app permission is enabled or disabled ..

 

Suppose first when we launch the application all the permission was enabled after that user disable some permission from the setting. So i need to check which permissions are enabled and disabled. 

 

Thanks.


----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to check app permission which is declared in bar-descriptor.xml file

you can't.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Benecore
Posts: 540
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....

Re: How to check app permission which is declared in bar-descriptor.xml file

[ Edited ]

You can check it like this:

For example if i want to know if application has read_device_identifying_information permisson than i just call some function from HardwareInfo for example.

HardwareInfo info;
if (!info.pin().isEmpty()){
    qDebug() << "DEVICE PERMISSION OK";
}else{
    qDebug() << "DEVICE PERMISSION ERROR";
}

i think this could work for all others permissions. Just call some specific function and if does not return value which must return then has no permission



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Developer
ankur_siwach
Posts: 148
Registered: ‎09-28-2012
My Device: Blackberry Developer

Re: How to check app permission which is declared in bar-descriptor.xml file

Thanks Benecore.

 

I 'll try it, can you told me how can we find out about access_shared and access_internet permission.

 

 


----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Benecore
Posts: 540
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....

Re: How to check app permission which is declared in bar-descriptor.xml file

access_shared you can check with QFileInfo

QFileInfo info("shared/documents");
if (info.isWritable()){
    qDebug() << "SHARED PERMISSION OK";
}else{
    qDebug() << "SHARED PERMISSION ERROR";
}

 and the access_internet hm, if you don't use the access_internet permission in your app, then app still has internet access, so this you can't check. You check only if is app connected to the internet



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Developer
ankur_siwach
Posts: 148
Registered: ‎09-28-2012
My Device: Blackberry Developer

Re: How to check app permission which is declared in bar-descriptor.xml file

Thanks a lot Benecore.

 

Its work for me.

 

One more thing i want to know..from where or how can we know which class is used for different different permission.

 


----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Benecore
Posts: 540
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....

Re: How to check app permission which is declared in bar-descriptor.xml file

I'm glad I helped<br><br>you need just find the specific classes. access_camera need the Camera classes etc...
Also this can help you to find some details
http://developer.blackberry.com/native/documentation/cascades/dev/tools/app_permissions.html


If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Developer
ankur_siwach
Posts: 148
Registered: ‎09-28-2012
My Device: Blackberry Developer

Re: How to check app permission which is declared in bar-descriptor.xml file

Ok..Thanks once again :smileyhappy:


----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
knobtviker
Posts: 145
Registered: ‎05-31-2013
My Device: BlackBerry Z10 Limited Edition

Re: How to check app permission which is declared in bar-descriptor.xml file

Unfortunately there is no official API for this. Only a collection of workarounds. I made a tester app for this, I should probably finish and open source it. Perhaps make it an embedded class for everyone to use. Will do this week.

New Developer
bDev
Posts: 40
Registered: ‎12-14-2013
My Device: Playbook

Re: How to check app permission which is declared in bar-descriptor.xml file