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..