user944513
user944513

Reputation:

how to get permission and licenses alert during installation in blackberry +java

I want to know how to get a permission and licenses alert during installation in BlackBerry Java.

I am using GPS, so there should be one alert displayed before installation that this application uses GPS. The user may then save or deny the request.

Thanks

Upvotes: 3

Views: 87

Answers (2)

Nate
Nate

Reputation: 31045

Mister Smith's answer is good, but there's one more piece needed. You mentioned that you wanted the permission alert during installation. In order to get that, you need something else, too.

For BlackBerry apps, you can define alternate entry points. This can create multiple instances of your application. A common reason for this, for example, would be to define one normal UI application, and another background application, to listen for push notifications.

In this case, you can create an application instance to simply run at startup, and run the permissions check (shown in Mister Smith's answer). When you define the entry point for the permission-checking "application", you will set it to Auto-run on startup in the BlackBerry_App_Descriptor.xml file, which will cause it to start as soon as the app installs.

See here for defining alternate entry points.

Upvotes: 0

Mister Smith
Mister Smith

Reputation: 28178

You can use ApplicationPermissionsManager

Example for GPS:

    ApplicationPermissions requestedPermissions = new ApplicationPermissions();         
    requestedPermissions.addPermission(ApplicationPermissions.PERMISSION_LOCATION_API));    
    //You can add additional required permissions to the batch of requested permissions

    boolean allGranted = ApplicationPermissionsManager.getInstance().invokePermissionsRequest(requestedPermissions);

Upvotes: 2

Related Questions