该文章或问题已被删除

Android 平台 Native.js 跳转系统设置 各个界面

从android应用程序跳转到系统的各个设置页面。
目前有两种方式一种是 android.provider.Settings包,一种是 com.android.settings 包名开头的。

一种以android.provider.Settings 开头的形式

操作Action描述android描述
ACTION_ACCESSIBILITY_SETTINGS辅助功能模块的显示设置。Activity Action: Show settings for accessibility modules.
ACTION_ADD_ACCOUNT显示屏幕上创建一个新帐户添加帐户。Activity Action: Show add account screen for creating a new account.
ACTION_AIRPLANE_MODE_SETTINGS显示设置,以允许进入/退出飞行模式。Activity Action: Show settings to allow entering/exiting airplane mode.
ACTION_APN_SETTINGS显示设置,以允许配 置的APN。Activity Action: Show settings to allow configuration of APNs.
ACTION_APPLICATION_DETAILS_SETTINGS有关特定应用程序的详细信息的显示屏幕。Activity Action: Show screen of details about a particular application.
ACTION_APPLICATION_DEVELOPMENT_SETTINGS显示设置,以允许应用程序开发相关的设置配置Activity Action: Show settings to allow configuration of application development-related settings.
ACTION_APPLICATION_SETTINGS显示设置,以允许应用程序相关的设置配置Activity Action: Show settings to allow configuration of application-related settings.
ACTION_BLUETOOTH_SETTINGS显示设置,以允许蓝牙配置Activity Action: Show settings to allow configuration of Bluetooth.
ACTION_DATA_ROAMING_SETTINGS选择of2G/3G显示设置Activity Action: Show settings for selection of2G/3G.
ACTION_DATE_SETTINGS显示日期和时间设置,以允许配 置Activity Action: Show settings to allow configuration of date and time.
ACTION_DEVICE_INFO_SETTINGS显示一般的设备信息设置(序列号,软件版本,电话号码,等)Activity Action: Show general device information settings (serial number, software version, phone number, etc.).
ACTION_DISPLAY_SETTINGS显示设置,以允许配 置显示Activity Action: Show settings to allow configuration of display.
ACTION_INPUT_METHOD_SETTINGS特别配置的输入方法,允许用户启用输入法的显示设置Activity Action: Show settings to configure input methods, in particular allowing the user to enable input methods.
ACTION_INPUT_METHOD_SUBTYPE_SETTINGS显示设置来启用/禁用输入法亚型Activity Action: Show settings to enable/disable input method subtypes.
ACTION_INTERNAL_STORAGE_SETTINGS内部存储的显示设置Activity Action: Show settings for internal storage.
ACTION_LOCALE_SETTINGS显示设置,以允许配 置的语言环境Activity Action: Show settings to allow configuration of locale.
ACTION_LOCATION_SOURCE_SETTINGS显示设置,以允许当前位置源的配置Activity Action: Show settings to allow configuration of current location sources.
ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS显示设置来管理所有的应用程序Activity Action: Show settings to manage all applications.
ACTION_MANAGE_APPLICATIONS_SETTINGS显示设置来管理安装的应用程序Activity Action: Show settings to manage installed applications.
ACTION_MEMORY_CARD_SETTINGS显示设置为存储卡存储Activity Action: Show settings for memory card storage.
ACTION_NETWORK_OPERATOR_SETTINGS选择网络运营商的显示设置Activity Action: Show settings for selecting the network operator.
ACTION_PRIVACY_SETTINGS显示设置,以允许配 置隐私选项Activity Action: Show settings to allow configuration of privacy options.
ACTION_QUICK_LAUNCH_SETTINGS显示设置,以允许快速启动快捷键的配置Activity Action: Show settings to allow configuration of quick launch shortcuts.
ACTION_SEARCH_SETTINGS全局搜索显示设置Activity Action: Show settings for global search.
ACTION_SECURITY_SETTINGS显示设置,以允许配 置的安全性和位置隐私Activity Action: Show settings to allow configuration of security and location privacy.
ACTION_SETTINGS显示系统设置Activity Action: Show system settings.
ACTION_SOUND_SETTINGS显示设置,以允许配 置声音和音量Activity Action: Show settings to allow configuration of sound and volume.
ACTION_SYNC_SETTINGS显示设置,以允许配 置同步设置Activity Action: Show settings to allow configuration of sync settings.
ACTION_USER_DICTIONARY_SETTINGS显示设置来管理用户输入字典Activity Action: Show settings to manage the user input dictionary.
ACTION_WIFI_IP_SETTINGS显示设置,以允许配 置一个静态IP地址的Wi – FiActivity Action: Show settings to allow configuration of a static IP address for Wi-Fi.
ACTION_WIFI_SETTINGS显示设置,以允许Wi – Fi配置Activity Action: Show settings to allow configuration of Wi-Fi.
ACTION_WIRELESS_SETTINGS显示设置,以允许配 置,如Wi – Fi,蓝牙和移动网络的无线控制Activity Action: Show settings to allow configuration of wireless controls such as Wi-Fi, Bluetooth and Mobile networks.
AUTHORITY
EXTRA_AUTHORITIES在推出活动的基础上给予的权力限制可选项。Activity Extra: Limit available options in launched activity based on the given authority.
EXTRA_INPUT_METHOD_ID


 使用的基础语法

var main = plus.android.runtimeMainActivity(); //获行当前的页面对象,activity 相当于一个页面
var Intent = plus.android.importClass('android.content.Intent'); //引入android.content.Intent,java 包,Intent 是一个意图,就是用它做些什么
var Settings = plus.android.importClass('android.provider.Settings'); //引用安卓系统设置包 Settings 
var intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);//可设置表中所有Action字段, 一些属性名称
main.startActivity(intent); //在activity 页面中启动一个 intent 意图,打开相关系统设置页面


 一种 以com.android.settings开头的形式


 com.android.settings 的相关设置


com.android.settings.Settings 手机系统设置 
com.android.settings.WirelessSettings 无线和网络设置 
com.android.settings.AccessibilitySettings 辅助功能设置 
com.android.settings.ActivityPicker 选择活动 
com.android.settings.ApnSettings APN设置 
com.android.settings.ApplicationSettings 应用程序设置 
com.android.settings.BandMode 设置GSM/UMTS波段 
com.android.settings.BatteryInfo 电池信息 
com.android.settings.DateTimeSettings 日期和时间设置 
com.android.settings.DateTimeSettingsSetupWizard 日期和时间设置2 
com.android.settings.DevelopmentSettings 开发者选项 
com.android.settings.DeviceAdminSettings 设备管理器 
com.android.settings.DeviceInfoSettings 关于手机 
com.android.settings.Display 显示—设置显示字体大小及预览 
com.android.settings.DisplaySettings 显示设置 
com.android.settings.DockSettings 底座设置 
com.android.settings.IccLockSettings SIM卡锁定设置 
com.android.settings.InstalledAppDetails 应用程序的详细信息页面 
com.android.settings.LanguageSettings 语言和输入法设置 
com.android.settings.LocalePicker 选择手机语言 
com.android.settings.LocalePickerInSetupWizard 选择手机语言2 
com.android.settings.ManageApplications 应用管理 
com.android.settings.MasterClear 恢复出厂设置 
com.android.settings.MediaFormat 格式化手机闪存 
com.android.settings.PhysicalKeyboardSettings 设置键盘 
com.android.settings.PrivacySettings 隐私设置 
com.android.settings.ProxySelector 代理设置 
com.android.settings.RadioInfo 手机信息 
com.android.settings.RunningServices 正在运行的程序(服务) 
com.android.settings.SecuritySettings 安全设置 
com.android.settings.SettingsSafetyLegalActivity 安全信息 
com.android.settings.SoundSettings 声音设置 
com.android.settings.TestingSettings 测试 
com.android.settings.TetherSettings 绑定与便携式热点 
com.android.settings.TextToSpeechSettings 文字转语音设置 
com.android.settings.UsageStats 使用情况统计 
com.android.settings.UserDictionarySettings 用户词典 
com.android.settings.VoiceInputOutputSettings 语音输入与输出设置
com.android.settings.wifi.WifiSettings"  打开wifi 界面

 使用的基础语法

var main = plus.android.runtimeMainActivity(); //获行当前的页面对象,activity 相当于一个页面
var Intent = plus.android.importClass('android.content.Intent'); //引入android.content.Intent,java 包,Intent 是一个意图,就是用它做些什么

var intent = new Intent(seting);// 添加到Intent	
    intent.setClassName("com.android.settings", "com.android.settings.wifi.WifiSettings");  //打开wifi 的界面
    main.startActivity(intent); //在activity 页面中启动一个 intent 意图,打开相关系统设置页面 

因为安卓的机种太多,android.provider.Settings 和 com.android.settings 方式,大家都可以试下,例如魅族手机,打开wifi 设置界面,用  android.provider.Settings 的 ACTION_WIFI_SETTINGS 方法 打开就会报错,要用 com.android.settings 的 com.android.settings.wifi.WifiSettings 才能打开。



示例,直接复制就能用

<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>Native.js调用 Android 系统设置</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
				<style>
			.mui-bar{ box-shadow: none; background: white; height:50px;}
			.mui-bar .mui-icon{ margin-top:0px; font-size:32px; color: #2f2f2f; }
			.mui-bar-nav.mui-bar .mui-icon{padding-left:5px;}
			.mui-bar .mui-title{margin-top:6px;color: #2f2f2f; font-weight: normal;margin-left:20px; }
			.more{ margin-top: 16px; margin-right: 5px;}
			.mui-bar:after
 {
position: absolute;
right: 0;
 bottom: 0;
left: 0;
height: 1px;
content: '';
-webkit-transform: scaleY(.5);
transform: scaleY(.5);
background-color:#dadada; 	
    		 }
 body{ background: white;}
 .mui-content .txt{ margin-top:20px; padding-left: 10px;}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<h1 class="mui-title">Native.js调用 Android 系统设置</h1>
			
		</header>
		<div class="mui-content">
			<p class="txt">例举部分示例</p>
			<ul id="list" class="mui-table-view mui-table-view-chevron">
				<li class="mui-table-view-cell" data-type="ACTION_WIFI_SETTINGS">
					<a class="mui-navigate-right" >
						Wi – Fi配置
					</a>
				</li>
				<li class="mui-table-view-cell" data-type="ACTION_NETWORK_OPERATOR_SETTINGS">
					<a class="mui-navigate-right" >
						网络运营商设置
					</a>
				</li>
				<li class="mui-table-view-cell" data-type="ACTION_MANAGE_APPLICATIONS_SETTINGS">
					<a class="mui-navigate-right" >
						设置管理安装的应用程序
					</a>
				</li>
				<li class="mui-table-view-cell" data-type="ACTION_DATA_ROAMING_SETTINGS">
					<a class="mui-navigate-right" >
						选择2G/3G/4G显示设置
					</a>
				</li>
				<li class="mui-table-view-cell" data-type="ACTION_BLUETOOTH_SETTINGS">
					<a class="mui-navigate-right" >
						蓝牙配置
					</a>
				</li>
				<li class="mui-table-view-cell" data-type="ACTION_AIRPLANE_MODE_SETTINGS">
					<a class="mui-navigate-right" >
						设置进入/退出飞行模式
					</a>
				</li>
				<li class="mui-table-view-cell" data-type="ACTION_INPUT_METHOD_SETTINGS">
					<a class="mui-navigate-right" >
						配置的输入法
					</a>
				</li>
				<li class="mui-table-view-cell" data-type="ACTION_SECURITY_SETTINGS">
					<a class="mui-navigate-right" >
						设置安全性和位置隐私
					</a>
				</li>
				<li class="mui-table-view-cell" data-type="ACTION_DATE_SETTINGS">
					<a class="mui-navigate-right" >
						设置日期和时间
					</a>
				</li>
				<li class="mui-table-view-cell" data-type="ACTION_LOCALE_SETTINGS">
					<a class="mui-navigate-right" >
						设置手机语言
					</a>
				</li>
			 </ul>	
		</div>
		
		
		<script src="js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init();
			
			mui.plusReady(function()
			{
				//点击事件
				mui("body").on("tap",".mui-table-view-cell",function()
				{
					var type=this.getAttribute("data-type");
					    
					    set(type);
					 
				});

			});
			
		   function set(type)
		   {
		   	
		var main = plus.android.runtimeMainActivity(); //获行当前的页面对象,activity 相当于一个页面
		var Intent = plus.android.importClass('android.content.Intent'); //引入android.content.Intent,java 包,Intent 是一个意图,就是用它做些什么
		var Settings = plus.android.importClass('android.provider.Settings'); //引用安卓系统设置包 Settings 	   
		var seting;

		    switch (type)
		   	{
		   		case "ACTION_WIFI_SETTINGS":  //wi-fi		
		   		var intent = new Intent();// 打开WIFI设置界面我们用com.android.settings.wifi.WifiSettings 的方式
			    intent.setClassName("com.android.settings", "com.android.settings.wifi.WifiSettings");
			    main.startActivity(intent); 
			    return;
		   		break; 
		   		case "ACTION_NETWORK_OPERATOR_SETTINGS": //网络设置
		   		seting=Settings.ACTION_NETWORK_OPERATOR_SETTINGS;break; 
		   		case "ACTION_MANAGE_APPLICATIONS_SETTINGS": //设置管理安装的应用程序
		   		seting=Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS;break;
		   		case "ACTION_DATA_ROAMING_SETTINGS": //2g,3g,4g设置
		   		seting=Settings.ACTION_DATA_ROAMING_SETTINGS;break;
		   		case "ACTION_BLUETOOTH_SETTINGS": // 蓝牙配置
		   		seting=Settings.ACTION_BLUETOOTH_SETTINGS;break;
		   		case "ACTION_AIRPLANE_MODE_SETTINGS": //设置进入/退出飞行模式
		   		seting=Settings.ACTION_AIRPLANE_MODE_SETTINGS;break; 
		   		case "ACTION_INPUT_METHOD_SETTINGS": //配置的输入法
		   		seting=Settings.ACTION_INPUT_METHOD_SETTINGS;break; 
		   		case "ACTION_SECURITY_SETTINGS": //设置安全性和位置隐私
		   		seting=Settings.ACTION_SECURITY_SETTINGS;break;
		   		case "ACTION_DATE_SETTINGS": //设置日期和时间
		   		seting=Settings.ACTION_DATE_SETTINGS;break;//设置日期和时间
		   		case "ACTION_LOCALE_SETTINGS": //设置手机语言
		   		seting=Settings.ACTION_LOCALE_SETTINGS;break;//设置手机语言
		   		default:break;
		   	}
		   	 
			var intent = new Intent(seting);// 添加到Intent	
			    main.startActivity(intent); //在activity 页面中启动一个 intent 意图,打开相关系统设置页面 
		   }
			
		</script>
	</body>

</html>
点赞 0      收藏 0

0 个评论

正在加载...

这里空空如也,快来补一刀!

加载更多

回答问题或评论文章请先 或者 注册