android / permissions-samples Goto Github PK
View Code? Open in Web Editor NEWMultiple samples showing the best practices in permissions on Android.
License: Apache License 2.0
Multiple samples showing the best practices in permissions on Android.
License: Apache License 2.0
.github/workflows/android.yml
Originally posted by @jen801 in #19 (review)
With the new Android 11, we have a change on permissions behaviour, adding:
Luckily, Android already give a method(RequestPermission
) that deal with all this cases.
On the permission guide Request App Permission where this project is linked (end of the page) we can see the usage of ActivityResultContracts.RequestPermission()
and ActivityResultCaller.registerForActivityResult
.
What can make the developer confused because registerForActivityResult
still on alpha for appCompat library.
Based on this, would be beneficial for the community to have a sample code for it. But since the library still not release this should be another sub-project until the appCompat release 1.3
and this code became the default one.
Hello world
Originally posted by @Agingvollkkaa99 in #64 (comment)
BasicPermissions
CameraPreviewActivity.java
// Get the rotation of the screen to adjust the preview image accordingly.
int displayRotation = getDisplay().getRotation();
Rasing exception on AVD API level 19
Android Studio 4.2.2
compileSdkVersion 30
I've noticed that the 'Never ask again' option is not handled in the given sample and this is a relatively common case when dealing with run-time permissions.
Hi,
tested on ONEPLUS 9 running android 11, I've got this error when clicking on the OPEN CAMERA PREVIEW
button:
E/libc: Access denied finding property "vendor.camera.aux.packagelist" W/asicpermissions: type=1400 audit(0.0:3799): avc: denied { read } for name="u:object_r:vendor_persist_camera_prop:s0" dev="tmpfs" ino=13601 scontext=u:r:untrusted_app:s0:c236,c256,c512,c768 tcontext=u:object_r:vendor_persist_camera_prop:s0 tclass=file permissive=0 app=com.example.android.basicpermissions E/libc: Access denied finding property "vendor.camera.hal1.packagelist" E/libc: Access denied finding property "vendor.camera.aux.packagelist" W/asicpermissions: type=1400 audit(0.0:3800): avc: denied { read } for name="u:object_r:vendor_persist_camera_prop:s0" dev="tmpfs" ino=13601 scontext=u:r:untrusted_app:s0:c236,c256,c512,c768 tcontext=u:object_r:vendor_persist_camera_prop:s0 tclass=file permissive=0 app=com.example.android.basicpermissions
but I get the the preview showed. I've also had this error message with another application that I can't list the back wide angle camera (CameraManager.getCameraIdList()
).
No error with Samsung Galaxy S10 (android 12).
I'll appreciate any help
không viết gì
[removed]
You app crashes on the emulator with
Process: com.example.android.basicpermissions, PID: 16924
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.basicpermissions/com.example.android.basicpermissions.camera.CameraPreviewActivity}: java.lang.RuntimeException: Fail to get camera info
Here's the screenshot. I propose handling this case elegantly.
If you press deny then deny again you can`t access permission option again, it just shows,
camera permission request was denied. Unless you uninstall the app.
Would be good to update the samples to target Android 12 since there are many new requirements that are being enforced on us developers.
Hello world
[removed]
à
cba
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.