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
aliajones
Posts: 81
Registered: ‎12-04-2012
My Device: BlackBerry@8520 smartphone(Edge,Wi-fi)

Recording Popup

My recording App is recording media,but even after installing it gives a popup regarding a media application is trying to record media.could anyone tell how can i disable that popup from coming up when my app is running.

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Recording Popup

did you manage the permissions and request http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/applicationcontrol/Application... ?
you can try to manage permissions manually in options to see if it helps if you grant the recording permission.
----------------------------------------------------------
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
Developer
aliajones
Posts: 81
Registered: ‎12-04-2012
My Device: BlackBerry@8520 smartphone(Edge,Wi-fi)

Re: Recording Popup

public static void Permissions()
    {
    	ApplicationPermissionsManager apm=ApplicationPermissionsManager.getInstance();
    	ApplicationPermissions ap= apm.getApplicationPermissions();
    	apm.addReasonProvider(ApplicationDescriptor.currentApplicationDescriptor(), new ReasonProvider()
    	                     {
    		 					public String getMessage(int i)
    		 					{
    		 						String msg="This app needs some help from ur memory";
    		 						switch(i)
    		 						{
    		 						case ApplicationPermissions.PERMISSION_DEVICE_SETTINGS:
    		 							msg="This app needs to look into your default setings";
    		 							break;
    		 							
    		 						case ApplicationPermissions.PERMISSION_AUTHENTICATOR_API:
    		 							msg="This app needs to look into your default setings";
    		 							break;
    		 							
    		 						case ApplicationPermissions.PERMISSION_APPLICATION_MANAGEMENT:
    		 							msg="This app needs to look into your default setings";
    		 							break;
    		 							
    		 						case ApplicationPermissions.PERMISSION_MEDIA:
    		 							msg="This app needs to look into your default setings";
    		 							break;
    		 						case ApplicationPermissions.PERMISSION_RECORDING:
    		 							msg="This app needs to look into your default setings";
    		 							break;
    		 							
    		 						case ApplicationPermissions.PERMISSION_PHONE:
    		 							msg="This app needs to look into your default setings";
    		 							break;
    		 							
    		 						case ApplicationPermissions.PERMISSION_SERVER_NETWORK:
    		 							msg="This app needs to look into your default setings";
    		 							break;
    		 							
    		 					
    		 				       }

    		 				    return msg;
    		 				    }
    		 				});
    	boolean permissionsOk = false;
    	if (
    		    ap.getPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS) ==
    		    ApplicationPermissions.VALUE_ALLOW
    		    &&
    		    ap.getPermission(ApplicationPermissions.PERMISSION_SERVER_NETWORK) ==
    		    ApplicationPermissions.VALUE_ALLOW
    		    &&
    		    ap.getPermission(ApplicationPermissions.PERMISSION_PHONE) ==
    		    ApplicationPermissions.VALUE_ALLOW
    		    &&
    		    ap.getPermission(ApplicationPermissions.PERMISSION_RECORDING) ==
    		    ApplicationPermissions.VALUE_ALLOW
    		    &&
    		    ap.getPermission(ApplicationPermissions.PERMISSION_MEDIA) ==
    		    ApplicationPermissions.VALUE_ALLOW
    		    &&
    		    ap.getPermission(ApplicationPermissions.PERMISSION_APPLICATION_MANAGEMENT) ==
    		    ApplicationPermissions.VALUE_ALLOW
    		    &&
    		    ap.getPermission(ApplicationPermissions.PERMISSION_AUTHENTICATOR_API) ==
    		    ApplicationPermissions.VALUE_ALLOW
    		    )
    	{
    		  permissionsOk = true;
    	}
    	
    	else {
    		  // Create a permission request for each of the permissions your application
    		  // needs. Note that you do not want to list all of the possible permission
    		  // values since that provides little value for the application or the user.
    		  // Please only request the permissions needed for your application.
    		  ApplicationPermissions permRequest = new ApplicationPermissions();
    		  permRequest.addPermission(ApplicationPermissions.PERMISSION_SERVER_NETWORK);
    		  permRequest.addPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS);
    		  permRequest.addPermission(ApplicationPermissions.PERMISSION_PHONE);
    		  permRequest.addPermission(ApplicationPermissions.PERMISSION_MEDIA);
    		  permRequest.addPermission(ApplicationPermissions.PERMISSION_APPLICATION_MANAGEMENT);
    		  permRequest.addPermission(ApplicationPermissions.PERMISSION_AUTHENTICATOR_API);
    		  permRequest.addPermission(ApplicationPermissions.PERMISSION_RECORDING);
    		  permRequest.addPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS);

    		  permissionsOk = apm.invokePermissionsRequest(permRequest);

    		}

    		if (permissionsOk) 
    		{
    	    }
    		else {

    		  // exit
    		  System.exit(0);

    		     }

    	}

 This is how i am managing permissions.But still after installing my application,a dialog box appears asking me a recording app is trying to record media.I dont want this dialog box to appear.thanks

Developer
nikita18
Posts: 144
Registered: ‎08-18-2012
My Device: Blackberry Curve 8520

Re: Recording Popup

If you need only one Recording permission then add only PERMISSION_RECORDING to your app. Remove unneccesary permissions from your app. Try this code:

 

private void requestApplicationPermissions() {
                        //      Set permissions for the application
                try{
                    ApplicationPermissions ap1 = ApplicationPermissionsManager.getInstance().getApplicationPermissions();
                    ApplicationPermissions ap2 = new ApplicationPermissions();
                    boolean needPermission=false;
                    if(ap1.getPermission(ApplicationPermissions.PERMISSION_PHONE)!=ApplicationPermissions.VALUE_ALLOW ){
                        needPermission=true;
                        ap2.addPermission(ApplicationPermissions.PERMISSION_PHONE);                                               
                    }
                    if(ap1.getPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION)!=ApplicationPermissions.VALUE_ALLOW ){
                        needPermission=true;
                        ap2.addPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION);
                        ap2.addPermission(ApplicationPermissions.PERMISSION_IDLE_TIMER);
                        ap2.addPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS);
                    }
                    if(needPermission){
                        Dialog.inform("Please save the permissions manually");
                        boolean permission=ApplicationPermissionsManager.getInstance().invokePermissionsRequest(ap2);
                        if(!permission){
                                                        Status.show("Application is exiting",3000);
                            myApp.exitApplication();
                        }
                    }
            }catch(Exception e){
                        System.out.println("Exception while setting permissions"+e);                       
                }         
        }