美文网首页Android开发
Android_SmartDeviceLink_Setting

Android_SmartDeviceLink_Setting

作者: 勇敢写信 | 来源:发表于2018-03-23 16:27 被阅读0次

我的博客

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);

相关文章

网友评论

    本文标题:Android_SmartDeviceLink_Setting

    本文链接:https://www.haomeiwen.com/subject/poyxcftx.html