Android_SmartDeviceLink_Setting the Navigation Destination

我的博客

Setting the Navigation Destination

设置导航目的地允许您发送一个GPS位置,您希望提示该用户使用他们的嵌入式导航导航到该位置。当使用SendLocation RPC时,您将不会收到关于用户如何与此位置交互的回调,只有当它成功地发送到Core并接收到时,才会收到回调,它将由内核使用嵌入式导航系统来处理这一点。

注意:

目前只支持嵌入式导航。这在目前的移动导航应用中是行不通的。
SendLocation是一个通常被OEMs限制的RPC。因此,如果不批准使用,您所连接的OEM可能限制应用程序的功能。
Determining the Result of SendLocation

SendLocation有3个可能的结果:
success;成功发送了SendLocation。
INVALID_DATA—您发送的请求包含无效数据并被拒绝。
DISALLOWED您的应用程序没有使用SendLocation的权限。

Detecting if SendLocation is Available

SendLocation是一个较新的RPC,因此有可能不是所有的head单元都支持它,特别是当您连接到一个没有嵌入式导航的head单元时。为了查看是否支持SendLocation,您可以在成功创建代理之后查看SdlProxyALM对象的gethmicap方法。

Using SendLocation

要使用SendLocation,您必须至少包含位置的经度和纬度。您还可以包括一个地址、名称、描述、电话号码和图像。

SendLocation sendLocation = new SendLocation();
sendLocation.setLatitudeDegrees(42.877737);
sendLocation.setLongitudeDegrees(-97.380967);
sendLocation.setLocationName("The Center");
sendLocation.setLocationDescription("Center of the United States");
 
// Create Address
OasisAddress address = new OasisAddress();
address.setSubThoroughfare("900");
address.setThoroughfare("Whiting Dr");
address.setLocality("Yankton");
address.setAdministrativeArea("SD");
address.setPostalCode("57078");
address.setCountryCode("US-SD");
address.setCountryName("United States");
 
sendLocation.setAddress(address);
 
// Monitor response
sendLocation.setOnRPCResponseListener(new OnRPCResponseListener() {
    @Override
    public void onResponse(int correlationId, RPCResponse response) {
        Result result = response.getResultCode();
        if(result.equals(Result.SUCCESS)){
            // SendLocation was successfully sent.
        }else if(result.equals(Result.INVALID_DATA)){
            // The request you sent contains invalid data and was rejected.
        }else if(result.equals(Result.DISALLOWED)){
            // Your app does not have permission to use SendLocation.
        }
    }
});
 
proxy.sendRPCRequest(sendLocation);
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 136,161评论 19 139
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 176,458评论 25 709
  • 发现 关注 消息 iOS 第三方库、插件、知名博客总结 作者大灰狼的小绵羊哥哥关注 2017.06.26 09:4...
    肇东周阅读 14,732评论 4 61
  • 当我意识到自己处在梦里时,我才惊觉这个世界的本来面目竟是这个样子。这里很混沌,无法辨识头顶上的或脚下踩踏的空间其确...
    常非常K阅读 3,290评论 1 3
  • 这是一篇我在4月25日写在日记本上的文字。 昨天,有位朋友说到老挝来好像很久了,我算了下日子,6号从家出发,8号办...
    陈飞鹏阅读 4,781评论 0 1

友情链接更多精彩内容