错误来自以下代码行:
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:" + mission.Customer.Lat + "," + mission.Customer.Lng));
startActivity(intent);
这是错误:
答案 0 :(得分:2)
没有可用的应用程序来处理expanded expansion-panel
URI。在设备上安装诸如Google Maps之类的产品。
在您的应用中,启动外部活动时捕获geo:
。添加某种适当的降级功能,例如为相同的坐标启动Web URL或显示错误消息。
答案 1 :(得分:1)
确保有时在此设备中启用了Google Map应用程序,有时该应用程序已从设备设置中禁用并导致此问题
答案 2 :(得分:1)
为避免使用隐式意图启动活动时发生崩溃。您应该使用下面的代码来验证是否有一个活动与给定条件相匹配的软件包。更多here或here
使用Kotlin:
if(intent.resolveActivity(packageManager) != null){
startActivity(intent)
}
答案 3 :(得分:-2)
可以打印例外:
try {
context.startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
例外可能是:
android.util.AndroidRuntimeException(Calling startActivity() from
outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag.
Is this really what you want?)
在这种情况下,您应该添加:
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);