Android 6 permission Check zxing

Source: Internet
Author: User

/*New private static final int my_permissions_request_call_camera = 1;//request code, self-defined//new Android6.0 permission check @Override        protected void OnStart () {Super.onstart (); if (Build.VERSION.SDK_INT >= build.version_codes. M) {if (Contextcompat.checkselfpermission (this, Manifest.permission.CAMERA)! = Packagemanager.permission_grant ED) {//If there is no authorization, request authorization Activitycompat.requestpermissions (this, new String[]{manifest.permissi On.            CAMERA}, My_permissions_request_call_camera); } else {//have authorization to open the camera directly}}}//new Android6.0 permission check @Override public void onre        Questpermissionsresult (int requestcode, @NonNull string[] permissions, @NonNull int[] grantresults) {//Judgment request code if (Requestcode = = My_permissions_request_call_camera) {//grantresults authorization result if (grantresults[0] = = packagemanager.permission_granted) {//successful, turn on camera//Callcamera (); } else {//authorization failed Toast.maketext (Captureactivity.this, "Permission Denied", Toast.length_shor                T). Show ();                Intent Intent = new Intent (settings.action_application_details_settings);                Intent.setdata (Uri.parse ("package:" + CaptureActivity.this.getPackageName ()));                CaptureActivity.this.startActivityForResult (Intent, 1028);            This.finish ();        } return;    } super.onrequestpermissionsresult (Requestcode, permissions, grantresults); }//New*/

Android 6 permission Check zxing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.