判断是否安装了Google地图
来源:互联网 发布:酥油饼网络剧 编辑:程序博客网 时间:2024/05/14 13:18
判断是否安装了Google地图,没有弹出Dialog提示安装:
判断是否安装了地图(无论什么地图)
类似这样子:
打开某一个已知程序
判断服务是否运行.
让你的Android应用与外部元素互动起来
http://blog.csdn.net/creativemobile/article/details/9673565
/** * For Google Maps Check * * @return */private boolean isGoogleMapsInstalled() {try {ApplicationInfo info = getPackageManager().getApplicationInfo("com.google.android.apps.maps", 0);return true;} catch (PackageManager.NameNotFoundException e) {return false;}}private OnClickListener getGoogleMapsListener() {return new OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("market://details?id=com.google.android.apps.maps"));startActivity(intent);// Finish the activity so they can't circumvent the checkfinish();}};}public void checkGoogleMapInstalled() {if (!this.isGoogleMapsInstalled()) {AlertDialog.Builder builder = new AlertDialog.Builder(this);builder.setMessage("Install Google Map ?");builder.setCancelable(false);builder.setPositiveButton("Install", getGoogleMapsListener());AlertDialog dialog = builder.create();dialog.show();}}
判断是否安装了地图(无论什么地图)
类似这样子:
try {Uri mUri = Uri.parse("geo:31.249351,121.45905?q=上海交通大学&z=18");intent = new Intent(Intent.ACTION_VIEW, mUri);startActivity(intent);} catch (Exception e) {// TODO: handle exceptionshowToast("您未安装地图,不能查看!");}
打开某一个已知程序
//打开日历try{intent=new Intent();intent.setComponent(new ComponentName("com.android.calendar", "com.android.calendar.LaunchActivity")); startActivity(intent);}catch (ActivityNotFoundException e) {// TODO: handle exceptionLog.i("tag", "Sorry,we have not found the App.");}//打开另一个已知包名和启动类的Apptry{intent=new Intent(); intent.setComponent(new ComponentName("com.ata.app","com.ata.app.LogoActivity")); startActivity(intent); }catch (ActivityNotFoundException e) {// TODO: handle exceptionLog.i("tag", "Sorry,we have not found the App.");}
判断服务是否运行.
/** * 判断服务是否运行. * @param context * @param className 判断的服务名字 * @return true 在运行 false 不在运行 */public static boolean isServiceRunning(Context mContext, String className) {ActivityManager activityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);List<ActivityManager.RunningServiceInfo> serviceList = activityManager.getRunningServices(Integer.MAX_VALUE);for(ActivityManager.RunningServiceInfo info:serviceList){if(info.service.getClassName().equals(className)){return true;}}return false;}
让你的Android应用与外部元素互动起来
http://blog.csdn.net/creativemobile/article/details/9673565
0 0
- 判断是否安装了Google地图
- 检测手机中是否安装了google地图,没有则提示安装,并跳转到地图查找特定的地点
- baidumap 判断是否安装百度地图客户端
- 获取百度地图和google地图是否安装
- 判断百度地图及高德地图是否安装
- 判断是否安装百度地图和高德地图
- JavaScript 判断是否安装了 Flash 插件
- delphi判断电脑是否安装了excel
- 如何判断是否安装了VC RUNTIME
- 如何判断是否安装了mysql linux
- 判断系统是否安装了flash
- 判断设备是否安装了app
- 判断是否安装了pdf阅读软件
- 如何判断python是否安装了pip
- android判断安装来源---是否是google play安装的
- 判断app是否安装百度地图,并启动导航 ios
- 判断手机是否安装高德/百度地图
- 检测系统中是否安装了Google map 应用
- 运用手势操作ListView中的Item
- centos简单搭建smtp服务
- 食神摇摇中图片的晃动效果
- 如何导入外部的frm、MYD、MYI文件到自己的mysql上查看
- ScrollView中浮动条的实现
- 判断是否安装了Google地图
- Notification的基本用法
- 个人名言
- MediaRecorder录音,MediaPlayer播放
- Java 接口
- 通过拍照或选择本地图片并剪裁图片设置成头像
- 左边可拖出菜单(页面)效果
- 左边和右边都可拖出页面的效果
- MySQL