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

Java Development

Reply
Developer
Posts: 86
Registered: ‎12-06-2012
My Device: Curve 8520
My Carrier: Blackberry store

How can set Application permission programmaticaly

i am create an application where i am using imei number of device.  i want to set permission for it on appliaction so that when i run it on device, application will not ask me for set permissions  

or same can we set for other permissions also ?

Developer
Posts: 31
Registered: ‎08-05-2011
My Device: 9550
My Carrier: Vodafone

Re: How can set Application permission programmaticaly

 

 

 

/***************************

*This is how one would set Permissions in UIApplications class

* setPermissions() method does it for me

*

*****/

 

import net.rim.device.api.applicationcontrol.ApplicationPermissions;
import net.rim.device.api.ui.UiApplication;

public class Application extends UiApplication {

 

/**
* @param args
*/
public static void main(String[] args) {

if (ApplicationManager.getApplicationManager().inStartup()) {

System.out.println("HHSKDJHKSDH");

} else {

Application app = new Application();
app.enterEventDispatcher();
}
}

public Application() {

// // String srtIMEInumbr =
// // GPRSInfo.imeiToString(GPRSInfo.getIMEI(),false);
//
// /**
// * Getting the BB Device ID, Will work on all OS
// */
// String strHexID = Integer.toHexString(DeviceInfo.getDeviceId())
// .toString();
//

setPermissions();

/** Pushes the Screen */


pushScreen(new HomeScreen());

private void setPermissions() {
// TODO Auto-generated method stub

// ApplicationPermissionsManager permissionsManager =
// ApplicationPermissionsManager
// .getInstance();

ApplicationPermissions newPermissions = new ApplicationPermissions();
newPermissions
.addPermission(ApplicationPermissions.PERMISSION_FILE_API);
newPermissions
.addPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS);
}

}

 

 

 


/*********************************************************************/
Please press the like button on the right side to thank me if my reply helped you and please mark posts as solved if you found a solution.
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How can set Application permission programmaticaly

Just to add to the previous post.

 

"when i run it on device, application will not ask me for set permissions"

Not possible to do this, the user will always be asked something.

 

But you can make sure you have permissions before you start your application using the Permissions API.  You should have a good sample already with Eclipse.  So have a look for it and review the well commented code. 

Developer
Posts: 86
Registered: ‎12-06-2012
My Device: Curve 8520
My Carrier: Blackberry store

Re: How can set Application permission programmaticaly

Hi peter,

 I need to remove Application permission dialog from application and want to add all permisstion implicitly allow through code.

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How can set Application permission programmaticaly

not possible
----------------------------------------------------------
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