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

Adobe AIR Development

Reply
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

BB10 Tip. No Shared File Access

If your app reads or writes files from the shared directory, it is a good idea to test your app when that permission is turned off for your app.

 

The best way to check is to do something like this:

////////////////////////////////////////////////////////////////////////
public static function checkSharedAccess() : void
{
	if( !File.documentsDirectory.exists )
	{
		//trace( 'error access docs' );
		var alert:AlertDialog = new AlertDialog();
		alert.title = 'Error';
		alert.message = "The application's permission to access shared files is not set correctly.  Please set 'Shared Files' to 'On' under the device settings: Security/Application Permissions. Do you want to check those settings now?"
		alert.addButton( 'Later', {id:'later'} );
		alert.addButton( 'Check Now', {id:'now'} );
		alert.addEventListener( DialogEvent.DIALOG_BUTTON_CLICKED, ProcessChecked );
		alert.show();
				
		function ProcessChecked( event : DialogEvent ) : void
		{
			if( event.responseBtnContext.id == 'now' )
			{
				navigateToURL( new URLRequest( 'settings://permissions' ) );
			}
		}
	}
}

 Most of this would work on the PlayBook as well, except for the ability to open up the settings panel.

See more here: https://developer.blackberry.com/cascades/documentation/device_platform/invocation/settings.html

Please use plain text.