Android 6.0 calls the perfect solution for camera album crash

Recently, the customer updated the system and found that the previous project flashed back when calling the camera. It was very strange. Later, after consulting, it was found that after Android 6.0, the program needs to authorize the camera permission. By default, a prompt will be given to allow the user to authorize. Personally, I feel that this feature is very good, which is summarized as follows:

Import Android V4 and V7 packages!

Android studio import is very simple. Right click the project and find the dependency.

Inherit appcompatactivity

Introduce required class libraries

Check camera permissions and request permissions

Receive callback method after authorization:

Hybrid application development solution

For hybrid application development, there are two solutions:

Change the existing plug-in and add permission access code (there may be some trouble)

Call the permission plug-in:

Installation:

Included permissions

Sample code

The above is the perfect solution for Android 6.0 calling camera album crash introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>