Android 起调系统功能,打开系统浏览器,拨打电话,发送短信,手机震动,跳转到设置通知开关页面

 1、打开系统浏览器

try {startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/jaredrummler/MaterialSpinner")));
} catch (ActivityNotFoundException ignored) {
}

 2、拨打电话

Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:"+phone));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
 

        Intent intent=new Intent();//设置打电话行为
//        intent.setAction(Intent.ACTION_CALL);intent.setAction(Intent.ACTION_DIAL);//设置数据,此处为电话号码
//        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.setData(Uri.parse("tel:12345678901"));startActivity(intent);

 

3、发送短信

//发送短信
private void sendSMSS() {Log.e("lgqq","....fa");String content = nret.getText().toString().trim();//短信内容String phone = telet.getText().toString().trim();//电话号码if (!content.isEmpty() && !phone.isEmpty()) {SmsManager manager = SmsManager.getDefault();ArrayList<String> strings = manager.divideMessage(content);for (int i = 0; i < strings.size(); i++) {manager.sendTextMessage(phone, null, content, null, null);}Toast.makeText(DiweiActivity.this, "发送成功", Toast.LENGTH_SHORT).show();} else {Toast.makeText(this, "手机号或内容不能为空", Toast.LENGTH_SHORT).show();return;}
}
private static final int SEND_SMS = 100;private void requestPermission() {//判断Android版本是否大于23if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {int checkCallPhonePermission = ContextCompat.checkSelfPermission(this, Manifest.permission.SEND_SMS);if (checkCallPhonePermission != PackageManager.PERMISSION_GRANTED) {ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.SEND_SMS}, SEND_SMS);Log.e("lgqq","...222.fa=="+checkCallPhonePermission);return;} else {Log.e("lgqq","..222244444..fa");sendSMSS();//已有权限}} else {//API 版本在23以下sendSMSS();}
}

 

4、Vibrator手机震动

 

1、权限

<uses-permission android:name="android.permission.VIBRATE"/>
2、初始化

private Vibrator vibrator;
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
3、开始震动

(1)一次性震动
vibrator.vibrate(10);//10震动时长
(2)波浪性震动
开启

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    vibrator.vibrate(VibrationEffect.createWaveform(new long[]{100L, 2000L, 1000L, 1000L, 3000L}, -1));
} else {
    vibrator.vibrate(new long[]{100L, 2000L, 1000L, 1000L, 3000L}, 0);
}
关闭

vibrator.cancel();

 

预览淘宝

    public void toshop(String tbPath){Intent intent = new Intent();intent.setAction("Android.intent.action.VIEW");Uri uri = Uri.parse(tbPath); // 商品地址intent.setData(uri);//详情页
//        intent.setClassName("com.taobao.taobao", "com.taobao.tao.detail.activity.DetailActivity");//店铺intent.setClassName("com.taobao.taobao", "com.taobao.android.shop.activity.ShopHomePageActivity");startActivity(intent);}

判断通知开启,跳转到通知设置系统页面

NotificationManagerCompat manager = NotificationManagerCompat.from(App.getTotalContext());
boolean isOpened = manager.areNotificationsEnabled();
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {Intent intent = new Intent();intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");intent.putExtra("app_package", getActivity().getPackageName());intent.putExtra("app_uid", getActivity().getApplicationInfo().uid);startActivity(intent);
} else if (android.os.Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {Intent intent = new Intent();intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);intent.addCategory(Intent.CATEGORY_DEFAULT);intent.setData(Uri.parse("package:" + getActivity().getPackageName()));startActivity(intent);
}

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/415030.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

B. 重载技术(overloading)

转载于:https://www.cnblogs.com/youyuanjuyou/p/8120968.html

Highchart series一次只显示一条

核心代码如下&#xff1a; plotOptions: {series: {events: {show: function () {const chart this.chartconst series chart.serieslet i series.lengthlet otherSerieswhile (i--) {otherSeries series[i];if (otherSeries ! this && otherSeries.visible) {oth…

android xml中设置水平虚线及竖直虚线

水平线背景 <?xml version"1.0" encoding"utf-8"?> <shape xmlns:android"http://schemas.android.com/apk/res/android"android:shape"line"><strokeandroid:width"1dp"android:color"color/colorA…

highcharts默认选中最后一个点数据

效果图如下&#xff1a; 核心代码如下&#xff1a; chart: {type: line,events: {load: function () {let chart thisconst points []Highcharts.each(chart.series, function (s) {if (s.visible) {points.push(s.points[s.points.length - 1])}})chart.tooltip.refresh(p…

Ajax——php基础知识(二)

header header(content-type:text/html; charset utf-8);//设置编码格式为:utf-8 header(location:http://www.baidu.com);//设置跳转到百度首页 header(refresh:3; urlhttp://www.xiaomi.com);//设置页面间隔刷新 数据类型 <?phpheader("content-type:text/html;char…

python utc 时间

python中&#xff0c;我们使用datetime处理日期、时间相关。 获取当前时间&#xff0c;主要有两个方法&#xff1a; datetime.now datetime.now()&#xff1a;读取的时间是系统的本地时间&#xff0c;也就是说&#xff0c;如果系统时区默认没有设置&#xff0c;那么读取的就是世…

[02] JSP内置对象

1、内置对象的来历JSP是由一些内置对象的&#xff0c;即不需要定义&#xff0c;也不需要我们主动创建&#xff0c;就可以直接使用的对象。当然&#xff0c;其对象名称也是固定的&#xff0c;无法修改&#xff0c;我们可以直接调用其相关方法。在 [01] JSP的基本认识 已经说过JS…

上传Android应用到腾讯应用宝,乐固加固应用使用

当我们开发完安卓系统APP之后。需要上传到应用市场 在上传到腾讯应用宝是&#xff0c;需要使用腾讯加固工具 乐固 加固apk。才能正常上架。 如没有加固应用会提示&#xff1a; 加固步骤: 1、下载乐固包&#xff1a;https://download.csdn.net/download/meixi_android/107534…

工作203:实现预览效果

1子组件 成功 ChangeRest(event, file){/* console.log(event)console.log(file)*//* console.log(URL.createObjectURL(file.raw))*/this.imageUrl URL.createObjectURL(file.raw);/* this.imageUrlevent.tmp_urlconsole.log(this.imageUrl)*/console.log(1)this.eventSav…

python根据文件路径获取上级目录路径

import ospath /Users/caowei/数据集/Stable/EN-2300-103-RevA.txtp_path os.path.abspath(os.path.join(path, "..")) print(p_path)saveDir os.path.dirname(path) print(saveDir)

【深入Java虚拟机】之一:Java内存区域与内存溢出

内存区域 Java虚拟机在执行Java程序的过程中会把他所管理的内存划分为若干个不同的数据区域。Java虚拟机规范将JVM所管理的内存分为以下几个运行时数据区&#xff1a;程序计数器、Java虚拟机栈、本地方法栈、Java堆、方法区。下面详细阐述各数据区所存储的数据类型。 程序计数器…

java.lang.NoSuchMethodError: android.app.Notification$Builder.setChannelId

报错原因&#xff1a;低版本安卓系统没有这个setChannelld方法 解决方法&#xff1a; 判断当前手机版本进行调用setChannelld if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {builder.setChannelId("com.tianxin.mapclient.liteapp"); }

工作204:进行输入成功后验证

this.$refs["form"].validate(valid > {if (valid) {setTimeout(() > {this.$message("校验成功")/*声明变量*/let method postAction;/*声明url* position()* *//*url/user*/let url this.url.add;/*4 判断是否有id 确定新增还是编辑 根据表单数…

python判断是否在docker中

设定很简单&#xff0c;docker中有一个文件.dockerenv&#xff0c;只要判断此文件是否存在&#xff0c;来判断python是否运行在docker环境中。代码如下&#xff1a; import os def idDocker():return os.path.exists(/.dockerenv)

文件手动删除后 同步到git

http://www.tk4479.net/xiaoyuanzhiying/article/details/44085135转载于:https://www.cnblogs.com/wzqx/p/8137829.html

Android应用安装apk版本升级,适配Android 8.0和Android 10.0下载安装,shell命令安装APK

安装失败&#xff0c;gradle.properties文件下添加 即可 android.injected.testOnly false shell命令安装 /*** 安装apk** param path apk文件路径*/ public void installAPK(String path) {Log.i(TAG, "installAPK:" path);com.dlc.xiaohaitun.utils.ShellUtil…

docker中centos遇到sudo: command not found

docker中的centos是精简环境&#xff0c;直接安装即可。 yum -y install sudo

Android BroadcastReceiver,广播与进程通讯,APK安装广播,获取已安装列表

1、创建广播接收器&#xff1a; /*** 作者&#xff1a;created by meixi* 邮箱&#xff1a;13164716840163.com* 日期&#xff1a;2018/11/1 09*/ public class MyBroadcastReceiver extends BroadcastReceiver {//需要实现的方法Overridepublic void onReceive(Context conte…