Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PermissionHandler callbacks are never called for separate process #17

Open
LockdownX7 opened this issue May 18, 2019 · 0 comments
Open

Comments

@LockdownX7
Copy link

My app runs a service on a separate process, defined in the manifest as such:

<service
	android:name=".ManagerService"
	android:process=":ManagerProcess"/>

This service requires permissions on certain user actions, and I'm requesting them in the following way:

String[] permissions = {Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA};
Permissions.Options options = new Permissions.Options()
	.setRationaleDialogTitle("test rationale")
	.setSettingsDialogTitle("test title")
	.setSettingsDialogMessage("test settings")
	.setSettingsText(context.getString(R.string.action_settings))
	.setCreateNewTask(true);    //Needs to create a task because we're asking for permissions outside of activity context
final String rationale = "placeholder";
Permissions.check(context, permissions, rationale, options, new PermissionHandler() {
	@Override
	public void onGranted() {
		//TODO
		Log.d("test4636", "granted");
		Toast.makeText(context, "granted", Toast.LENGTH_LONG).show();
	}

	@Override
	public void onDenied(Context context, ArrayList<String> deniedPermissions) {
		//TODO
		Log.d("test4636", "denied");
		Toast.makeText(context, "denied", Toast.LENGTH_LONG).show();
		for (String perm : deniedPermissions) {
			Log.d("test4636", perm);
		}
	}
});

With this setup, onGranted() and onDenied() are never called. Removing android:process=":ManagerProcess" from the service solves the issue, but I can't implement it that way because the service has to be running on a separate process due to other requirements. Is there any workaround to getting the callbacks to work when using android:process?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant