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定位開啓的參數卻跳轉到系統安全設置頁面。

 

 聲明:歡迎轉載,轉載請註明文章出處!!!

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

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章