Android mobile phone system open the Rights Management page

Source: Internet
Author: User

Recently the project is busy, finally has the free time to write the thing.

Believe that the Android has been known, the current mobile phone system is a variety of, when we go to request the user's permission, will always pop up whether the allowed dialog box.

And once the user is not careful to refuse, the next time will not ask, and many small white users do not know how to set. This leads to a very bad user experience.

After research, I found that the system, such as Xiaomi, Meizu, and these full-street systems, can be opened by the implicit intention to open the Permissions Settings page.

This refers to the Rights Management page of the app itself.

Some people have written similar articles before, but they are scattered, and I have summed up these methods here.

Not much to say, directly on the code.

First is the most egg pain millet, Baidu a lot of predecessors left the method, found can not open, no way, only through the ADB Dumpsys activity activities command to see

After some research has finally opened.

/** * Jump to MIUI's Rights Management page*/  Private voidgotomiuipermission () {Intent I=NewIntent ("Miui.intent.action.APP_PERM_EDITOR"); ComponentName componentname=NewComponentName ("Com.miui.securitycenter","com.miui.permcenter.permissions.AppPermissionsEditorActivity");      I.setcomponent (componentname); I.putextra ("Extra_pkgname", Getpackagename ()); Try{startactivity (i); } Catch(Exception e) {e.printstacktrace ();      Gotomeizupermission (); }  }  

Next up Meizu's code

/** * Jump to Meizu's rights management system*/  Private voidgotomeizupermission () {Intent Intent=NewIntent ("Com.meizu.safe.security.SHOW_APPSEC");      Intent.addcategory (Intent.category_default); Intent.putextra ("PackageName", buildconfig.application_id); Try{startactivity (intent); } Catch(Exception e) {e.printstacktrace ();      Gotohuaweipermission (); }  }  

Huawei's system is not the same, some systems are Huawei's own rights management, and 6.0 is the use of the original Rights Management page, currently has only one 6.0 of Huawei mobile phones,

Temporarily did not study to open the method, if have known the great God trouble to inform

But it doesn't matter, we can retreat. Second, open the Rights Management page for the app you're using

/** * Huawei's Rights Management page*/  Private voidgotohuaweipermission () {Try{Intent Intent=NewIntent ();          Intent.setflags (Intent.flag_activity_new_task); ComponentName Comp=NewComponentName ("Com.huawei.systemmanager","com.huawei.permissionmanager.ui.MainActivity");//Huawei Rights Managementintent.setcomponent (comp);      StartActivity (Intent); } Catch(Exception e) {e.printstacktrace ();      StartActivity (Getappdetailsettingintent ()); }    }  

At present, the three systems have been studied, for the native system, and other systems, if the method can not be found, it is also possible to first guide the user to the System settings page

/** * Get App Details page Intent * * @return*/  PrivateIntent getappdetailsettingintent () {Intent localintent=NewIntent ();      Localintent.addflags (Intent.flag_activity_new_task); if(Build.VERSION.SDK_INT >=9) {localintent.setaction ("Android.settings.APPLICATION_DETAILS_SETTINGS"); Localintent.setdata (Uri.fromparts (" Package", Getpackagename (),NULL)); } Else if(Build.VERSION.SDK_INT <=8) {localintent.setaction (Intent.action_view); Localintent.setclassname ("com.android.settings","com.android.settings.InstalledAppDetails"); Localintent.putextra ("Com.android.settings.ApplicationPkgName", Getpackagename ()); }      returnlocalintent; }  

Get to intent after the direct startactivity just fine ...

Attainments is not enough, only know so much, welcome you Daniel to add!

Android mobile phone system open the Rights Management page

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.