Pushing a Permissions Screen

Related

[DOCCUSTOMER:Permission Issues]
BlackBerry Permissions

Things to note

  • Permissions should be prompted as soon as possible. Currently the favorite is to do this in lifecycleInitialize(). Doing this any later will initialize APIs that may require permissions and foil the whole reason for prompting at startup.
  • The QueueManager and all other classes that may require permissions should not be initialized at the Application construction time. They should instead be initialized in lifecycleInitialize() after the call to super.lifecycleInitialize().
  • The permissions screen should be pushed using a modal screen to prevent the application from continuing before all permissions have been set.

Example

protected void lifecycleInitialize() {

    if ( PermissionService.shouldRequestPermissions() ) {

        Screens.pushModalScreen( new PermissionsScreen() );
    }

    super.lifecycleInitialize();

    setQueueManager( new QueueManager( Application.class.getName(), UID.QUEUE_MANAGER_ID ) );

    CacheManager.setCacheManager( new BBCacheManager() );
    RichContentObjectFactories.setObjectFactory( new RichContentObjectFactory() );
}

Example

protected void lifecycleInitialize() {

    if ( !EulaStore.instance().load().isAccepted() ) {

        Screens.pushModalScreen( new EulaContainer() );
    }

    if ( PermissionsManager.instance().shouldRequestPermissions() ) {

        Screens.pushModalScreen( new PermissionsContainer() );
    }

    super.lifecycleInitialize();

    setQueueManager( new QueueManager( Application.class.getName(), UID.QUEUE_MANAGER_ID ) );
}
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

© 2011 Metova, Inc.