标签:
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<ResolveInfo> 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
Android APP代码拨打电话、打开手机分享功能等隐式意图
标签:
原文地址:http://www.cnblogs.com/lcchuguo/p/5117115.html