-
-
Notifications
You must be signed in to change notification settings - Fork 372
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
Add support for platform-specific app permissions #547
Comments
This is a much needed feature |
isn't there a way to give permissions to apps on android? |
@gauravghodinde: Currently the only way is to manually edit the AndroidManifest file in the generated project. Note that this will be overwritten every time you run |
#472 contains ideas for how we could update a template without regenerating the whole project and forcing a full rebuild. |
I would like to know if this feature will be added within next year |
That depends on how many people need it. If anyone wants this feature, please post the following information:
|
Thank you for responding.
|
Thanks: that's a common use case, so it'll be one of the first things we look at in this area. |
thank you; that would be great. I would like to use the Beeware framework in an university course to teach student agile project management. This decision was made so we can move from Android Studio which needs more resources and computational power to run. |
We could support Android permissions and various other customizations by adding a However, this would be more difficult than the Dockerfile and build.gradle cases, because you can't simply concatenate two XML files: they would need to be merged. Also, simply adding a permission to the manifest isn't enough: you also need ask the user to grant it at runtime. So this would be much easier if there was a higher-level API as mentioned above. |
Thank for all the effort guys. just jotting myself down as i'd love this type of feature. which platform your app runs on which permission you need Cheers guys! |
Hi @julianrwood, Basic file system access on Android doesn't require any permissions. If you're using Toga, you can use Although this API is available in the current stable Toga release, it isn't documented in the "stable" version of the docs, so I've linked to the "latest" version. This will be fixed by the next Toga release. There used to be permissions for accessing the device's photos, downloads, etc., but newer versions of Android no longer allow direct access to these locations even if you have the permission. Instead, you should use the system file picker, as shown here and here. |
Hey @mhsmith
Appreciate the help and the extra resources. The android app development is new to me, it's hella cool though and you guys are doing awesome work |
WIthout access to network permissions, Toga doesn't really help much in Android. If you could fix this with a template and make a short tutorial on how to use it, then I'd develop 100s of apps using Toga. You have a great start, but it won't spread far unless you fix REST capabilities. |
The Briefcase Android template already has network permissions (see here). If you're having a problem, please create a separate issue and give full details. |
Tried it back in January. Will try it again next week. Thanks!
Sent from my Verizon, Samsung Galaxy smartphone
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Malcolm Smith ***@***.***>
Sent: Tuesday, July 18, 2023 3:39:07 PM
To: beeware/briefcase ***@***.***>
Cc: Jacob Barrow ***@***.***>; Comment ***@***.***>
Subject: Re: [beeware/briefcase] Add support for platform-specific app permissions (#547)
The Briefcase Android template already has network permissions (see here<https://github.com/beeware/briefcase-android-gradle-template/blob/main/%7B%7B%20cookiecutter.format%20%7D%7D/app/src/main/AndroidManifest.xml#L3>). If you're having a problem, please create a separate issue and give full details.
—
Reply to this email directly, view it on GitHub<#547 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BBFBCWZU2ND5A5C3UXURLY3XQ3Q5XANCNFSM4VE4CFRQ>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Thank you for reaching out!
Sent from my Verizon, Samsung Galaxy smartphone
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Malcolm Smith ***@***.***>
Sent: Tuesday, July 18, 2023 3:39:07 PM
To: beeware/briefcase ***@***.***>
Cc: Jacob Barrow ***@***.***>; Comment ***@***.***>
Subject: Re: [beeware/briefcase] Add support for platform-specific app permissions (#547)
The Briefcase Android template already has network permissions (see here<https://github.com/beeware/briefcase-android-gradle-template/blob/main/%7B%7B%20cookiecutter.format%20%7D%7D/app/src/main/AndroidManifest.xml#L3>). If you're having a problem, please create a separate issue and give full details.
—
Reply to this email directly, view it on GitHub<#547 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BBFBCWZU2ND5A5C3UXURLY3XQ3Q5XANCNFSM4VE4CFRQ>.
You are receiving this because you commented.Message ID: ***@***.***>
|
I'll add that the BeeWare tutorial explicitly includes a step that is an example of performing a REST request. |
Its clear that you are very protective of your software. When I tried it back in Dec/Jan the network permissions werent baked into the template. Since picking Android back up, I looked back into the project and noticed permissions werent easy to add into the Beeware enterprise from the start. Thats the main takeaway. We dont want to rebuild or dive into the gradle files to make the changes. Separately, the Java api should be abstracted through base classes. Firstly, as Python programmers we hate seeing Java bindings explicitly. Second, it looks more professional. Third, it allows programmers the ability to extend these base classes.The point I was trying to make is that I have to search for hours to figure out how these bindings work. Wastes our time. Finally, the point of having a cross platform app builder is to be able to natively integrate with the platform. The last time I tried it, apk signing was virtually non existant. Making an easier pipeline for signing to get onto the google play store should be a priority. These are necessary items that need to mature for user acceptance. Originally, I was going to help with this project. Unfortunately, it still needs to mature. |
Thank you for your feedback. We are very much aware that permissions are a required feature. That is why this ticket is open. We are also aware that APK signing is a feature we require; that is why #1268 exists. Unfortunately, the only way for any project to become mature is for it to start as a less mature project. We have prioritised features that we have evaluated to be more pressing to the app development process. This doesn't mean that permissions aren't important; just that in our estimation, they're less important than the other features we have chosen to implement. You are more than welcome to have a different opinion on those priorities. |
According to the Git history, they've been in the template for 3 years, so the cause of your issue must have been something else. If you can reproduce it and let us know the details, we'll look into it. |
For some example Android code, see #1497 (reply in thread). |
Here's a survey of what we need to be able to support for app permissions. Defining permissionsiOSAn app doesn't need to pre-declare permissions; but it does need to provide keys in the Info.plist file that describe the reason that specific permissions may be requested. This text is shown to the user when the permission is requested. There are also some boolean flags that indicate an initial state of a sensor (e.g., location services starting in a "reduced accuracy" mode). However, these can be changed at runtime. Finally, some app features (e.g., iCloud access, Push notifications) need to be added as a "capability", which become part of the Xcode project definition. macOSAs with iOS, there are some permissions that need descriptions in the Info.plist file; however, there's a lot less of these than on iOS. There is also a need to add capabilities for some features. macOS apps also need to declare boolean flags in the Entitlements.plist file when the app is signed. AndroidAndroid uses declarations in the AndroidManifest.xml; these take 3 forms:
Common permissionsThis isn't a comprehensive list of all permissions; but it is the set of features that are likely targets for Toga in the near future. Camera
Location
Kinematics
Photo library
File storage
Push Notifications
Other
|
API proposal
|
|
The API design looks good, just a few comments:
The permissions are already in the template, so I don't understand this.
I don't think it's worth adding a general Briefcase configuration mechanism for something which only exists on one platform. The default behavior seems reasonable, and if the developer cares about making their app available to the tiny minority of devices which don't have a camera, they can do that with
It would be cleaner to just make it accept nested XML tags, e.g. the above example would become:
But there's no need to do that yet. |
@Fipaddict: Unfortunately those permissions don't work anymore on current versions of Android. Instead, you can launch the system file picker as shown at beeware/toga#1158 (comment). |
What I was aiming at was consolidating all permissions in the same place, rather than having some in the template, and some in the permissions mechanism.
Yeah - I wasn't 100% happy with
Ok - the specific example there was a flub on my part. What I was trying to highlight was that we could/would specify configuration items in pyproject.toml that insert arbitrary verbatim blocks of content into the AndroidManifest XML.
Except that this also adds a second application tag, doesn't it? Unless you're proposing some sort of XML-merging... which is definitely more than I was planning on doing here. |
I was proposing XML merging, but there's no need to include it as part of this work. Just pointing out that it would be a backwards-compatible generalization of the current work, which would support arbitrary additions to the manifest file without the need to have a separate Briefcase configuration item for every single block. |
Is your feature request related to a problem? Please describe.
Some platforms (most notably mobile platforms, but desktop platforms are moving in a similar direction) have explicit permissions for accessing certain hardware features, such as:
At present, Briefcase provides no way to customise these permissions when rolling out an app.
Describe the solution you'd like
We should add a configuration parameter that can be used to inject permissions into the app template. Suggested format:
In this example asking for access to the camera on iOS, the key is the platform-specific permission, and the value is a short explanation for why the permission is required. The explanatory text is required on iOS and macOS; it does not appear to be required on Android, but could still serve as useful documentation.
These definitions would then be passed to the app template, and injected as required.
Two "stretch" goals that might be worth considering:
"Universal" permission aliases Every platform has permissions for accessing the camera, geolocation, and so on. It may be worth establishing a "Briefcase alias" for these universal permissions, which is mapped to the platform specific name (or names) as required. That way, you could ask for
camera
permission, rather than needing to know the platform-specific name of each permission.Extracting required permissions from library metadata Manually defining permissions is simple from an implementation perspective, but doesn't lead to a good user experience. It is reasonable to expect that first-time app developers won't understand why their app doesn't work when they're calling a camera API, but haven't manually added permissions. Ideally, we would be able to determine the permissions required based on the libraries that are used. For example, a
toga-camera
library would declare in library metadata that it requires thecamera
permission, and that would be automatically injected into the app template. The explanatory text associated with that permission would need to be a placeholder; however, we can provide placeholder text, and warn the user that placeholder text has been provided and should be overridden (in a similar way to how default icons are currently used and a warning provided).However, regardless of whether we hit these stretch goals, a framework for platform-specific permissions will be required. This is because OS release schedules are decoupled from Briefcase release schedules; a new OS may introduce new permissions (or alter permission semantics); and we need to be able to support those permissions without requiring a new Briefcase release.
Describe alternatives you've considered
The current alternative is to:
briefcase create
(1) isn't persistent between app builds; (2) requires more effort than should be required.
The text was updated successfully, but these errors were encountered: