Android app opens the phone's Network Settings screen

Source: Internet
Author: User

The application can not be separated from the server network interaction, but there is time in the network information bad time, we have to give users the prompt to make network settings, in our application generally there will be a Network load error (failure) of the page, there is an operation control, click can enter the mobile phone network settings interface, the code is simple:

/**intent Object */

Intent Intent = null;
/** judge the version of the mobile phone system is more than 10 API is 3.0 or more versions and Meizu mobile phone * *
if (Android.os.Build.VERSION.SDK_INT > &&!android.os.build.manufacturer.equals ("Meizu")) {
Intent = new Intent (Android.provider.Settings.ACTION_WIRELESS_SETTINGS);
}
else {
Intent = new Intent ();
ComponentName component = new ComponentName ("Com.android.settings", "Com.android.settings.WirelessSetti NGS ");
Intent.setcomponent (component);
Intent.setaction ("Android.intent.action.VIEW");
}
Context.startactivity (Intent);

The above is used to determine whether the Meizu phone, because we found in the project, the use of the Meizu phone also call the else code in the line.

Android app opens the phone's Network Settings screen

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.