Skip to content

Conversation

thecompez
Copy link

Users can now view the permissions requests themselves.

In the Android section, it was observed that no application for a permission has been applied! The codes I sent are enough to solve this problem.

Users can now view the permissions requests themselves.
@hebasto
Copy link
Member

hebasto commented Dec 2, 2021

cc @icota

Java method removed from BitcoinQtActivity.

We use the QtAndroid method instead.

Note: The androidextras module must be added into the project.

This method is enough.
@icota
Copy link
Contributor

icota commented Dec 4, 2021

Thank you for cleaning up the Java part @KambizAsadzadeh.

Can you please fix the CI and give us a brief rationale for the PR? What are you able to do with these changes that you weren't able to do before?

@thecompez
Copy link
Author

thecompez commented Dec 4, 2021

Thank you for cleaning up the Java part @KambizAsadzadeh.

You're welcome!

Can you please fix the CI and give us a brief rationale for the PR?
What are you able to do with these changes that you weren't able to do before?

Check this please:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

In this section there is a request for permission to write on storage right? Well, In this case a native dialog must be displayed to accept or reject this request and this is important in terms of privacy. This is not possible by default and you must do this manually. :)

Like this one:
https://github.com/KambizAsadzadeh/gui/blob/450c5464bfd8ee57d2eb7594b2ba207ee6eca64a/src/qt/bitcoin.cpp#L492

We have two ways to do this, one is to use Java code or JNI inside C++ and the other (I suggest the C++ method) is to use method checkPermission on QtAndroid class. this method checks if the permission was granted or not. This function should be called every time when the application starts for needed permissions, as the users might disable them from Android Settings.

@icota
Copy link
Contributor

icota commented Dec 5, 2021

Thank you for clarifying @KambizAsadzadeh. This is something that is needed but if we follow good practices probably doesn't belong at startup as not all users will opt to use external storage.

According to the docs:

Wait for the user to invoke the task or action in your app that requires access to specific private user data. At that time, your app can request the runtime permission that's required for accessing that data.

IMO there should be a GUI prompt/explainer and only then should we trigger the OS modal to ask for these permissions. Something to discuss with the design team?

@thecompez
Copy link
Author

thecompez commented Dec 5, 2021

Thank you for clarifying @KambizAsadzadeh. This is something that is needed but if we follow good practices probably doesn't belong at startup as not all users will opt to use external storage.

According to the docs:

Wait for the user to invoke the task or action in your app that requires access to specific private user data. At that time, your app can request the runtime permission that's required for accessing that data.

You're welcome, Thank you for your good comments.
I agree with you regarding UX terms, In my opinion, it's better to call the QtAndroid::checkPermission method where this permission is needed instead of startup. Can you show me the part you used for writing external storage?

Rule 4:

Check whether the user has already granted the runtime permission that your app requires. If so, your app can access the private user data. If not, continue to the next step.
You must check whether you have that permission every time you perform an operation that requires that permission.

@icota
Copy link
Contributor

icota commented Dec 12, 2021

Can you show me the part you used for writing external storage?

I never used external storage, my hardware doesn't even have such an option.

As it stands right now we use the .bitcoin folder in app sandbox. I think I enabled WRITE_EXTERNAL_STORAGE because I believed this would be granted without user intervention. In that case one could change the conf and use the SD.

I realise that external storage is a big use-case (people repurposing old phones) so moving forward I suggest we either:

  • Document how to enable this manually (long press on the app icon -> go to permissions)
  • Design some sort of UI around this (prompt user if she wants to use external storage -> trigger permissions modal)

@DrahtBot
Copy link
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #149 (Intro: Have user choose assumevalid by luke-jr)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@thecompez thecompez closed this Jun 13, 2022
@bitcoin-core bitcoin-core locked and limited conversation to collaborators Jun 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants