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
tek3
Posts: 190
Registered: ‎07-08-2009
My Device: Not Specified

Getting Event Injector Permission

Hi all,

 

I am trying to get permission for EventInjector . I want to capture Image from the camera and display that image in my application , and for this i need to have EventInjector Permission. My code to get Permission is like:

 

 

try{
	      final ApplicationPermissionsManager appPermissionsManager = ApplicationPermissionsManager.getInstance();
			final ApplicationPermissions permissions = new ApplicationPermissions();
			int[] keys = permissions.getPermissionKeys();	
			for (int i = 0; i < keys.length; i++) {
		          int key = keys[i];
		          if(key == ApplicationPermissions.PERMISSION_EVENT_INJECTOR);
		          {
		        	  hasAppPermission = true;
		        	  break;
		          }
		      }
			if(!hasAppPermission)
			{
				UiApplication.getUiApplication().invokeAndWait(new Runnable(){
				public void run(){
				permissions.addPermission( ApplicationPermissions.PERMISSION_EVENT_INJECTOR );
				if(permissions.getPermission( ApplicationPermissions.PERMISSION_EVENT_INJECTOR) != ApplicationPermissions.VALUE_ALLOW)
				appPermissionsManager.invokePermissionsRequest( permissions );
					}
				});
			}

			if(!permissions.containsPermissionKey(ApplicationPermissions.PERMISSION_EVENT_INJECTOR));
              permissions.addPermission( ApplicationPermissions.PERMISSION_EVENT_INJECTOR );
             if(permissions.getPermission( ApplicationPermissions.PERMISSION_EVENT_INJECTOR) != ApplicationPermissions.VALUE_ALLOW)
			{	
			}
			else
				System.out.println("*********Permission is already set******");
	   }catch(Exception e){
		  System.out.println("Exception caught :" + e);

 The problem is that i am not prompted for any permission when i capture the image and my application is denied the permission.

 

Thanx in advance..

 

Please use plain text.
Developer
tek3
Posts: 190
Registered: ‎07-08-2009
My Device: Not Specified

Re: Getting Event Injector Permission

Currently i am testing on Curve 8900.

Please use plain text.
Developer
tek3
Posts: 190
Registered: ‎07-08-2009
My Device: Not Specified

Re: Getting Event Injector Permission

anyone??

Please use plain text.