简体   繁体   English

如何使用意图打开 Sygic 地图?

[英]How to open Sygic maps using intent?

I am trying to search for an place in the sygic app using我正在尝试使用 sygic 应用程序搜索一个地方

  String str = "com.sygic.aura://search|Gas%Station";
  startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str)));

as intended by the documentation .按照文档的意图。 However the code only opens the app, and the search bar is empty.但是代码只打开了应用程序,搜索栏是空的。 It doesn't search for anything.它不搜索任何东西。

What am I doing wrong?我究竟做错了什么? I have spent hours trying to look for and figure out a solution.我花了几个小时试图寻找并找出解决方案。

Few trials you could make, if you havent done so, from my research on sygic documentation and google( I have not used the sygic app)从我对 sygic 文档和谷歌的研究中,如果你还没有这样做,你可以做很少的试验(我没有使用 sygic 应用程序)

  1. Try using + sign for space, like Gas+Station in your search string, if %20 is not solving the issue.如果 %20 不能解决问题,请尝试在搜索字符串中使用 + 号作为空格,例如 Gas+Station。 URL encoding the space character: + or %20? URL 编码空格字符:+ 或 %20?

  2. Since the doucmentation mentions to follow encoding, try rewriting Url as per documnentation example " Please note that for majority of uses the parameter string needs to be URL-encoded (so called percent encoding). It normally relates to the following characters: "#%<>[]^`{|} and the SPACE.由于文档提到要遵循编码,请尝试按照文档示例重写 Url “请注意,对于大多数用途,参数字符串需要进行 URL 编码(所谓的百分比编码)。它通常与以下字符有关:“#% <>[]^`{|} 和空格。 For exact rules check the documentation on Encoding Example: Instead of com.sygic.aura://route_download|http://dat.my.com/my route.sif use com.sygic.aura://route_download%7Chttp%3A%2F%2Fdata.my.com%2Fmy%20route.sif"有关确切规则,请查看有关编码示例的文档: 而不是 com.sygic.aura://route_download|http://dat.my.com/my route.sif 使用 com.sygic.aura://route_download%7Chttp%3A %2F%2Fdata.my.com%2Fmy%20route.sif"

  3. Checkout this example provided in documentation.查看文档中提供的此示例。 Maybe you want to split "Gas Station" into 2 strings也许您想将“加油站”拆分为 2 个字符串

    String lon = "15.06591";字符串 lon = "15.06591"; String lat = "47.73341";字符串 lat = "47.73341"; String type = "drive";字符串类型=“驱动器”; String str = "com.sygic.aura://coordinate|"字符串 str = "com.sygic.aura://coordinate|" + lon + "|" + 隆 + "|" + lat + "|" + 纬度 + “|” + type; + 类型; startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str)));

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

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