简体   繁体   English

Android:createChooser不适用于地图,它始终会打开Goog​​le地图

[英]Android: createChooser not working for map it always open google map

it works in all devices below 6.0 open with shows available maps app like waze , google map , sygic .. but this chooser not showing in android nougat although there is not set any by default app . 它适用于6.0以下的所有设备,并显示可用的地图应用程序(例如位智,谷歌地图,sygic ..),但此选择器未显示在android牛轧糖中,尽管默认情况下未设置任何应用程序。 any help highly appreciated. 任何帮助,高度赞赏。

 String uri = "http://maps.google.com/maps?q=loc:"+24.871560+","+67.129752;
    Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
    intent.setData(Uri.parse(uri));
    Intent chooser = Intent.createChooser(intent, "Open with");
    startActivity(chooser);

Can confirm that this is troublesome on Android 7. On Android 8 things behave normal again. 可以确认这在Android 7上很麻烦。在Android 8上,一切再次恢复正常。

For Android 7 i had luck changing 对于Android 7,我的运气有所变化

intent.setData(Uri.parse(uri));

to

intent.setDataAndType(Uri.parse(uri), "text/html");

But only after installing a second browser like FireFox. 但仅在安装第二个浏览器(如FireFox)之后。

Now i can choose between Chrome and FireFox but choosing Chrome will bring up the Maps app. 现在,我可以在Chrome和FireFox之间进行选择,但是选择Chrome将启动Maps应用。

What a terrible behaviour! 多么可怕的行为!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM