android 拨打电话app,Android APP代码拨打电话、打开手机分享功能等隐式意图

Android APP拨打电话:

Intent intent=new Intent(Intent.ACTION_DIAL,Uri.parse("tel:"+110));

startActivity(intent);

}

Android APP打开电话薄:

Intent intent = new Intent(Intent.ACTION_PICK,ContactsContract.Contacts.CONTENT_URI);

startActivity(intent);

Android APP短信分享:

Intent sendIntent = new Intent(Intent.ACTION_VIEW);

sendIntent.putExtra("sms_body", "#短信分享#");

sendIntent.setType("vnd.android-dir/mms-sms");

startActivity(sendIntent);

打开手机的分享功能:

Intent sendIntent = new Intent(Intent.ACTION_SEND);

//  sendIntent.setType("image/png");//图片

//File f = new File(Environment.getExternalStorageDirectory() + "/Pictures/2.png");

//Uri u = Uri.fromFile(f);

//sendIntent.putExtra(Intent.EXTRA_STREAM, u);

sendIntent.setType("text/plain");//文字

sendIntent.putExtra(Intent.EXTRA_SUBJECT, "#好友分享#");

// 自己主动加入的发送的详细信息

sendIntent.putExtra(Intent.EXTRA_TEXT, "我如今正在玩应用,一起增加吧。很多其它资讯详见:http://www.xx.com");

sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

startActivity(Intent.createChooser(sendIntent, getTitle()));

打开应用商店进行评价:

Uri uri=Uri.parse("market://details?

id=" + Activity.this.getPackageName());

Intent intent=new Intent(Intent.ACTION_VIEW, uri);

PackageManager pm = SettingActivity.this.getPackageManager();

List list = pm.queryIntentActivities(intent, 0);

if(list.size()==0){

Toast.makeText(SettingActivity.this, "还未安装软件商店", Toast.LENGTH_SHORT).show();

}else{

startActivity(intent);

}

创建桌面快捷图标:

//发送广播的意图,要创建快捷图标了 Intent intent = new Intent(); intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); //快捷方式 要包括3个重要的信息 1,名称 2.图标 3.干什么事情 intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "仔仔手机安全卫士"); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher)); //桌面点击图标相应的意图。

Intent shortcutIntent = new Intent(); shortcutIntent.setAction("android.intent.action.MAIN"); shortcutIntent.addCategory("android.intent.category.LAUNCHER"); shortcutIntent.setClassName(getPackageName(), "com.zaizai.safty.MainActivity"); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); sendBroadcast(intent);

需加入权限

com.android.launcher.permission.INSTALL_SHORTCUT

MIME TYPE对比表:http://tool.oschina.net/commons       http://blog.sina.com.cn/s/blog_446cc66b0100ublv.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值