我是靠谱客的博主 阳光鞋子,最近开发中收集的这篇文章主要介绍android应用程序跳转到系统的各个设置页面,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

在开发过程中,当我们的程序检测到某个功能项没打开或者没设置的时候,需要我们在程序中跳转设置页面供用户设置后返回我们的程序才能用我们程序的某一功能,这样,我们就有必要去了解以下内容:

 

在android SDK文档中有这样一个类,android.provider.Settings类提供android系统各个页面的跳转常量:

使用实例例:startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)),即可跳到android手机网络设置页面。

如果要launch Mobile Networks Setting页面按如下方法:
Intent intent=new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);
ComponentName cName = new ComponentName(“com.android.phone”,”com.android.phone.Settings”);
intent.setComponent(cName);
startActivity(intent);

 

如果要进入Networks Operators页面按如下方法:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName(“com.android.phone”, “com.android.phone.NetworkSetting”);
startActivity(intent);

 

以上为网上提供的跳转方法是从自己软件的包名跳转到系统的包名,大家都知道,android特别的烂,时不时改变程序的结构,不同版本可能包名什么不一样的,此外,android应用层的包名若是不知道,则无法跳转,经不认真测试,好像会报错,个人感觉也是特别的麻烦。然而android为我们提供比startActivity更加简便的方法,就是startActivityForResult,使用startActivityForResult跳转设置页面设置完成后还可以返回自己的程序页面。下面是个人的实现方法:

比如,我要跳转系统”辅助功能“设置页面,则用一下代码即可:

Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
startActivityForResult(intent, REQUESTCODE);

备注:REQUESTCODE为声明的静态 int 型常量

==================== 以下为跳转个设置页面的参数  =============================

 

Constants
String ACTION_ACCESSIBILITY_SETTINGS Activity Action: Show settings for accessibility modules.
String ACTION_ADD_ACCOUNT Activity Action: Show add account screen for creating a new account.
String ACTION_AIRPLANE_MODE_SETTINGS Activity Action: Show settings to allow entering/exiting airplane mode.
String ACTION_APN_SETTINGS Activity Action: Show settings to allow configuration of APNs.
String ACTION_APPLICATION_DETAILS_SETTINGS Activity Action: Show screen of details about a particular application.
String ACTION_APPLICATION_DEVELOPMENT_SETTINGS Activity Action: Show settings to allow configuration of application development-related settings.
String ACTION_APPLICATION_SETTINGS Activity Action: Show settings to allow configuration of application-related settings.
String ACTION_BLUETOOTH_SETTINGS Activity Action: Show settings to allow configuration of Bluetooth.
String ACTION_DATA_ROAMING_SETTINGS Activity Action: Show settings for selection of 2G/3G.
String ACTION_DATE_SETTINGS Activity Action: Show settings to allow configuration of date and time.
String ACTION_DEVICE_INFO_SETTINGS Activity Action: Show general device information settings (serial number, software version, phone number, etc.).
String ACTION_DISPLAY_SETTINGS Activity Action: Show settings to allow configuration of display.
String ACTION_INPUT_METHOD_SETTINGS Activity Action: Show settings to configure input methods, in particular allowing the user to enable input methods.
String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS Activity Action: Show settings to enable/disable input method subtypes.
String ACTION_INTERNAL_STORAGE_SETTINGS Activity Action: Show settings for internal storage.
String ACTION_LOCALE_SETTINGS Activity Action: Show settings to allow configuration of locale.
String ACTION_LOCATION_SOURCE_SETTINGS Activity Action: Show settings to allow configuration of current location sources.
String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS Activity Action: Show settings to manage all applications.
String ACTION_MANAGE_APPLICATIONS_SETTINGS Activity Action: Show settings to manage installed applications.
String ACTION_MEMORY_CARD_SETTINGS Activity Action: Show settings for memory card storage.
String ACTION_NETWORK_OPERATOR_SETTINGS Activity Action: Show settings for selecting the network operator.
String ACTION_NFCSHARING_SETTINGS Activity Action: Show NFC Sharing settings.
String ACTION_NFC_SETTINGS Activity Action: Show NFC settings.
String ACTION_PRIVACY_SETTINGS Activity Action: Show settings to allow configuration of privacy options.
String ACTION_QUICK_LAUNCH_SETTINGS Activity Action: Show settings to allow configuration of quick launch shortcuts.
String ACTION_SEARCH_SETTINGS Activity Action: Show settings for global search.
String ACTION_SECURITY_SETTINGS Activity Action: Show settings to allow configuration of security and location privacy.
String ACTION_SETTINGS Activity Action: Show system settings.
String ACTION_SOUND_SETTINGS Activity Action: Show settings to allow configuration of sound and volume.
String ACTION_SYNC_SETTINGS Activity Action: Show settings to allow configuration of sync settings.
String ACTION_USER_DICTIONARY_SETTINGS Activity Action: Show settings to manage the user input dictionary.
String ACTION_WIFI_IP_SETTINGS Activity Action: Show settings to allow configuration of a static IP address for Wi-Fi.
String ACTION_WIFI_SETTINGS Activity Action: Show settings to allow configuration of Wi-Fi.
String ACTION_WIRELESS_SETTINGS Activity Action: Show settings to allow configuration of wireless controls such as Wi-Fi, Bluetooth and Mobile networks.
String AUTHORITY  
String EXTRA_AUTHORITIES Activity Extra: Limit available options in launched activity based on the given authority.
String EXTRA_INPUT_METHOD_ID  


 

 

以上为2012-7-12在android开发文档中截取的参数,最新参数请关注android官网的开发文档http://developer.android.com/reference/android/provider/Settings.html

=============================  华丽的分割线  =============================

以下为网上摘录的部分参数:

 

 

String      

ACTION_ACCESSIBILITY_SETTINGS
辅助功能模块的显示设置。

Activity Action: Show settings for accessibility modules.

String

ACTION_ADD_ACCOUNT
显示屏幕上创建一个新帐户添加帐户。

Activity Action: Show add account screen for creating a new account.

String

ACTION_AIRPLANE_MODE_SETTINGS
显示设置,以允许进入/退出飞行模式。

Activity Action: Show settings to allow entering/exiting airplane mode.

String

ACTION_APN_SETTINGS
显示设置,以允许配​​置的APN。

Activity Action: Show settings to allow configuration of APNs.

String

ACTION_APPLICATION_DETAILS_SETTINGS
有关特定应用程序的详细信息的显示屏幕。

Activity Action: Show screen of details about a particular application.

String

ACTION_APPLICATION_DEVELOPMENT_SETTINGS
显示设置,以允许应用程序开发相关的设置配置

Activity Action: Show settings to allow configuration of application development-related settings.

String

ACTION_APPLICATION_SETTINGS
显示设置,以允许应用程序相关的设置配置

Activity Action: Show settings to allow configuration of application-related settings.

String

ACTION_BLUETOOTH_SETTINGS
显示设置,以允许蓝牙配置

Activity Action: Show settings to allow configuration of Bluetooth.

String

ACTION_DATA_ROAMING_SETTINGS
选择of2G/3G显示设置

Activity Action: Show settings for selection of2G/3G.

String

ACTION_DATE_SETTINGS
显示日期和时间设置,以允许配​​置

Activity Action: Show settings to allow configuration of date and time.

String

ACTION_DEVICE_INFO_SETTINGS
显示一般的设备信息设置(序列号,软件版本,电话号码,等)

Activity Action: Show general device information settings (serial number, software version, phone number, etc.).

String

ACTION_DISPLAY_SETTINGS
显示设置,以允许配​​置显示

Activity Action: Show settings to allow configuration of display.

String

ACTION_INPUT_METHOD_SETTINGS
特别配置的输入方法,允许用户启用输入法的显示设置

Activity Action: Show settings to configure input methods, in particular allowing the user to enable input methods.

String

ACTION_INPUT_METHOD_SUBTYPE_SETTINGS
显示设置来启用/禁用输入法亚型

Activity Action: Show settings to enable/disable input method subtypes.

String

ACTION_INTERNAL_STORAGE_SETTINGS
内部存储的显示设置

Activity Action: Show settings for internal storage.

String

ACTION_LOCALE_SETTINGS
显示设置,以允许配​​置的语言环境

Activity Action: Show settings to allow configuration of locale.

String

ACTION_LOCATION_SOURCE_SETTINGS
显示设置,以允许当前位置源的配置

Activity Action: Show settings to allow configuration of current location sources.

String

ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS
显示设置来管理所有的应用程序

Activity Action: Show settings to manage all applications.

String

ACTION_MANAGE_APPLICATIONS_SETTINGS
显示设置来管理安装的应用程序

Activity Action: Show settings to manage installed applications.

String

ACTION_MEMORY_CARD_SETTINGS
显示设置为存储卡存储

Activity Action: Show settings for memory card storage.

String

ACTION_NETWORK_OPERATOR_SETTINGS
选择网络运营商的显示设置

Activity Action: Show settings for selecting the network operator.

String

ACTION_PRIVACY_SETTINGS
显示设置,以允许配​​置隐私选项

Activity Action: Show settings to allow configuration of privacy options.

String

ACTION_QUICK_LAUNCH_SETTINGS
显示设置,以允许快速启动快捷键的配置

Activity Action: Show settings to allow configuration of quick launch shortcuts.

String

ACTION_SEARCH_SETTINGS
全局搜索显示设置

Activity Action: Show settings for global search.

String

ACTION_SECURITY_SETTINGS
显示设置,以允许配​​置的安全性和位置隐私

Activity Action: Show settings to allow configuration of security and location privacy.

String

ACTION_SETTINGS
显示系统设置

Activity Action: Show system settings.

String

ACTION_SOUND_SETTINGS
显示设置,以允许配​​置声音和音量

Activity Action: Show settings to allow configuration of sound and volume.

String

ACTION_SYNC_SETTINGS
显示设置,以允许配​​置同步设置

Activity Action: Show settings to allow configuration of sync settings.

String

ACTION_USER_DICTIONARY_SETTINGS
显示设置来管理用户输入字典

Activity Action: Show settings to manage the user input dictionary.

String

ACTION_WIFI_IP_SETTINGS
显示设置,以允许配​​置一个静态IP地址的Wi – Fi

Activity Action: Show settings to allow configuration of a static IP address for Wi-Fi.

String

ACTION_WIFI_SETTINGS
显示设置,以允许Wi – Fi配置

Activity Action: Show settings to allow configuration of Wi-Fi.

String

ACTION_WIRELESS_SETTINGS
显示设置,以允许配​​置,如Wi – Fi,蓝牙和移动网络的无线控制

Activity Action: Show settings to allow configuration of wireless controls such as Wi-Fi, Bluetooth and Mobile networks.

String

AUTHORITY

 

String

EXTRA_AUTHORITIES
在推出活动的基础上给予的权力限制可选项。

Activity Extra: Limit available options in launched activity based on the given authority.

String

EXTRA_INPUT_METHOD_ID

 

 

特别注意:以上的设置参数针对android  SDK 2.x版本的,经过我的测试,我的手机是4.0.3版本的,GPS定位开启的参数却跳转到系统安全设置页面。

 

 声明:欢迎转载,转载请注明文章出处!!!

☞   温馨提示:  返回我的博客索引

 

 

 

最后

以上就是阳光鞋子为你收集整理的android应用程序跳转到系统的各个设置页面的全部内容,希望文章能够帮你解决android应用程序跳转到系统的各个设置页面所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部