这工作得很好,启动谷歌播放音乐(虽然古怪它给我的“播放音乐”或“谷歌播放音乐”中选择)时:无活动处理的意图,开始谷歌地图
Intent musicIntent = new Intent(Intent.ACTION_MAIN);
musicIntent.setPackage("com.google.android.music");
musicIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(musicIntent);
Google地图的相同内容不起作用。这:
Intent mapIntent = new Intent(Intent.ACTION_MAIN);
mapIntent.setPackage("com.google.android.apps.maps");
mapIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(mapIntent);
给出:
Unhandled exception in callback
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.MAIN flg=0x10000000 pkg=com.google.android.apps.maps }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1805)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1514)
at android.app.ContextImpl.startActivity(ContextImpl.java:663)
at android.app.ContextImpl.startActivity(ContextImpl.java:645)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:331)
我仔细检查过包的名称。我只能猜测这不是我应该使用的字符串。我究竟做错了什么?
安装该设备上的谷歌地图? – Blackbelt