android系统设置页面的相关跳转

在 uniapp 开发的 APP项目中 可以运行,其它框架没有测试过!

if (plus.os.name == 'Android') { // 判断是Android
    // 获取应用主Activity实例对象
	const main = plus.android.runtimeMainActivity();
					
	// 此方法以String形式返回此实体的包名称
	const pkName = main.getPackageName();
					
	// getApplicationInfo() :返回在其清单标记中定义的应用程序名称, plusGetAttribute : 获取Java类对象的静态属性
	const uid = main.getApplicationInfo().plusGetAttribute("uid");
					
	// 导入类对象后,就可以通过.操作符直接调用对象(类对象/实例对象)的方法。 注意:导入类对象将会消耗较多的系统资源,通常不应该导入过多的类对象,可以使用plus.android.invoke()来调用未导入类实例对象的方法。
	let NotificationManagerCompat = plus.android.importClass("android.support.v4.app.NotificationManagerCompat");
					
	//android.support.v4升级为androidx
	if (NotificationManagerCompat == null) {
		NotificationManagerCompat = plus.android.importClass("androidx.core.app.NotificationManagerCompat");
	};

    // areNotificationsEnabled() 返回来自调用包的通知是否被阻止。
	const areNotificationsEnabled = NotificationManagerCompat.from(main).areNotificationsEnabled();


    // 未开通‘允许通知’权限,则弹窗提醒开通,并点击确认后,跳转到系统设置页面进行设置  
	if (!areNotificationsEnabled) {
	    uni.showModal({
			title: '通知权限开启提醒',
			content: '您还没有开启通知权限,无法接受到消息通知,请前往设置!',
			confirmText: '去设置',
			success: function(res) {
								
			    if (res.confirm) {
					let Intent = plus.android.importClass('android.content.Intent');
					const intent = new Intent('android.settings.APP_NOTIFICATION_SETTINGS');  // // APP_NOTIFICATION_SETTINGS 通知权限
					intent.putExtra('android.provider.extra.APP_PACKAGE', pkName);
                    // 跳转到该应用的系统通知设置页
					main.startActivity(intent);
									
				};
								
			}
		});
	};

}

跳转其它系统设置页 :


const intent = new Intent("android.settings.ACCESSIBILITY_SETTINGS");      //辅助功能
const intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS");      //添加账户
const intent = new Intent("android.settings.AIRPLANE_MODE_SETTINGS");      //系统设置首页
const intent = new Intent("android.settings.APN_SETTINGS");      //APN设置
const intent = new Intent("android.settings.APPLICATION_SETTINGS");      //应用管理
const intent = new Intent("android.settings.BATTERY_SAVER_SETTINGS");      //节电助手
const intent = new Intent("android.settings.BLUETOOTH_SETTINGS");      //蓝牙
const intent = new Intent("android.settings.CAPTIONING_SETTINGS");      //字幕
const intent = new Intent("android.settings.CAST_SETTINGS");      //无线显示
const intent = new Intent("android.settings.DATA_ROAMING_SETTINGS");      //移动网络
const intent = new Intent("android.settings.DATE_SETTINGS");      //日期和时间设置
const intent = new Intent("android.settings.DEVICE_INFO_SETTINGS");      //关于手机
const intent = new Intent("android.settings.DISPLAY_SETTINGS");      //显示设置
const intent = new Intent("android.settings.DREAM_SETTINGS");      //互动屏保设置
const intent = new Intent("android.settings.HARD_KEYBOARD_SETTINGS");      //实体键盘
const intent = new Intent("android.settings.HOME_SETTINGS");      //应用权限,默认应用设置,特殊权限
const intent = new Intent("android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS");      //忽略电池优化设置
const intent = new Intent("android.settings.INPUT_METHOD_SETTINGS");      //可用虚拟键盘设置
const intent = new Intent("android.settings.INPUT_METHOD_SUBTYPE_SETTINGS");      //安卓键盘语言设置(AOSP)
const intent = new Intent("android.settings.INTERNAL_STORAGE_SETTINGS");      //内存和存储
const intent = new Intent("android.settings.LOCALE_SETTINGS");      //语言偏好设置
const intent = new Intent("android.settings.LOCATION_SOURCE_SETTINGS");      //定位服务设置
const intent = new Intent("android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS");      //所有应用
const intent = new Intent("android.settings.MANAGE_APPLICATIONS_SETTINGS");      //应用管理
const intent = new Intent("android.settings.MANAGE_DEFAULT_APPS_SETTINGS");      //与ACTION_HOME_SETTINGS相同
const intent = new Intent("android.settings.action.MANAGE_OVERLAY_PERMISSION");      //在其他应用上层显示,悬浮窗
const intent = new Intent("android.settings.MANAGE_UNKNOWN_APP_SOURCES");      //安装未知应用 安卓8.0
const intent = new Intent("android.settings.action.MANAGE_WRITE_SETTINGS");      //可修改系统设置 权限
const intent = new Intent("android.settings.MEMORY_CARD_SETTINGS");      //内存与存储
const intent = new Intent("android.settings.NETWORK_OPERATOR_SETTINGS");      //可用网络选择
const intent = new Intent("android.settings.NFCSHARING_SETTINGS");      //NFC设置
const intent = new Intent("android.settings.NFC_SETTINGS");      //网络中的 更多设置
const intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");      //通知权限设置
const intent = new Intent("android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS");      //勿扰权限设置
const intent = new Intent("android.settings.ACTION_PRINT_SETTINGS");      //打印服务设置
const intent = new Intent("android.settings.PRIVACY_SETTINGS");      //备份和重置
const intent = new Intent("android.settings.SECURITY_SETTINGS");      //安全设置
const intent = new Intent("android.settings.SHOW_REGULATORY_INFO");      //监管信息
const intent = new Intent("android.settings.SOUND_SETTINGS");      //声音设置
const intent = new Intent("android.settings.SYNC_SETTINGS");      //添加账户设置
const intent = new Intent("android.settings.USAGE_ACCESS_SETTINGS");      //有权查看使用情况的应用
const intent = new Intent("android.settings.USER_DICTIONARY_SETTINGS");      //个人词典
const intent = new Intent("android.settings.VOICE_INPUT_SETTINGS");      //辅助应用和语音输入
const intent = new Intent("android.settings.VPN_SETTINGS");      //VPN设置
const intent = new Intent("android.settings.VR_LISTENER_SETTINGS");      //VR助手
const intent = new Intent("android.settings.WEBVIEW_SETTINGS");      //选择webview
const intent = new Intent("android.settings.WIFI_IP_SETTINGS");      //高级WLAN设置
const intent = new Intent("android.settings.WIFI_SETTINGS");      //选择WIFI,连接WIFI

参考文章:

【Auto.js】[系统Intent]_系统设置页面的相关intent跳转

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Android Studio 中实现界面跳转可以使用 Intent 实现。以下是一个简单的示例: 1. 在你想要跳转到的界面的 Activity 中,在 onCreate() 方法中添加以下代码: ```java Button button = findViewById(R.id.button); // 获取按钮实例 button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, OrderActivity.class); // 创建 Intent 实例 startActivity(intent); // 启动 OrderActivity } }); ``` 2. 在布局文件中添加一个按钮,并为其设置 id 属性: ```xml <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="跳转到订单页面" /> ``` 3. 创建 OrderActivity 类,并在 AndroidManifest.xml 文件中注册该 Activity: ```java public class OrderActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_order); } } ``` ```xml <activity android:name=".OrderActivity" /> ``` 以上示例中,MainActivity 是当前 Activity,OrderActivity 是要跳转到的 Activity。在 MainActivity 中,我们获取了一个按钮实例,为其设置了一个点击事件,当用户点击该按钮时,会创建一个 Intent 实例,并指定要跳转到的 Activity。然后调用 startActivity() 方法启动 OrderActivity。在 OrderActivity 中,我们只是简单地设置了一个布局文件。 希望这个示例能够帮助到你。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值