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

Ask user to grant INTERNET permission to app if needed #160

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elviscapiaq
Copy link
Collaborator

@elviscapiaq elviscapiaq commented Jan 10, 2025

This PR is an starting point of the implementation.
Currently, there's no way to determine if the target Android app has the android.permission.INTERNET granted.
Since android.permission.INTERNET is a normal permission, it must be declared at install time (https://developer.android.com/training/permissions/declaring). Therefore, we cannot modify it at runtime.

The current solution checks if android.permission.INTERNET is granted. If not, it returns an error message asking the user to add this permission in the AndroidManifest.xml file.

Remember we need android.permission.INTERNET granted to use the gRPC service. On the other hand, since Android 11 we don't need to grant the android.permission.WRITE_EXTERNAL_STORAGE, It is depreciated. For future needs we can use `MANAGE_EXTERNAL_STORAGE. to access specific files.

@elviscapiaq elviscapiaq marked this pull request as draft January 10, 2025 23:35
@@ -249,6 +265,16 @@ bool run_package(Dive::DeviceManager& mgr,
return false;
}

std::string command_query = absl::
StrFormat("adb shell dumpsys package %s | grep \"android.permission.INTERNET: granted=true\"",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious, what is the difference between this adb cmd and editing the manifest file?

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

Successfully merging this pull request may close these issues.

2 participants