Hi viewers!
PLease suggest how to overcome from this exception, my code is given below:
String TestFile = "file:///" + RTTToneImpl.getEmergencyTone();
Player player;
try
{
player = Manager.createPlayer(TestFile);
}
catch(ControlledAccessException e)
{
Dialog errorDialog = new Dialog(0, "Please use the BlackBerry Options application to allow Media Access permission for Ring Trump Tones.", 0, Bitmap.getPredefinedBitmap(2), 0L);
errorDialog.doModal();
System.exit(0);
}
catch(IOException e)
{
Dialog errorDialog = new Dialog(0, "Caught IOException type when checking media permission:- " + e.getMessage(), 0, Bitmap.getPredefinedBitmap(2), 0L);
errorDialog.doModal();
System.exit(0);
}
catch(Exception e)
{
Dialog errorDialog = new Dialog(0, "Unexpected exception type when checking media permission:- " + e.getMessage(), 0, Bitmap.getPredefinedBitmap(2), 0L);
errorDialog.doModal();
System.exit(0);
}
ApplicationPermissions permRequest = ApplicationPermissionsManager.getInstance().getApplicationPermissions();
if( permRequest.getPermission( ApplicationPermissions.PERMISSION_MEDIA ) == ApplicationPermissions.VALUE_ALLOW )
{
return ;
}
permRequest = new ApplicationPermissions();
permRequest.addPermission( ApplicationPermissions.PERMISSION_MEDIA );
permRequest.addPermission( ApplicationPermissions.PERMISSION_FILE_API );
ApplicationPermissionsManager.getInstance().invokePermissionsRequest( permRequest );
Thanks and Regards Mintu