【问题标题】:How to integrate google map in automotive apps in android?如何将谷歌地图集成到安卓的汽车应用程序中?
【发布时间】:2021-10-28 22:44:47
【问题描述】:

我将谷歌地图集成到我们的安卓应用程序中。如果我在 Nexus 5X 模拟器中运行应用程序,它加载正常;没有观察到问题。当我在 android 汽车模拟器中运行相同的应用程序时..一旦应用程序启动并显示为 google play 服务正在更新但同时地图未加载。

谁能告诉我是什么问题?谷歌地图可以集成到汽车平台吗?

下面是我的代码

    public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

private GoogleMap mMap;
private ActivityMapsBinding binding;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    binding = ActivityMapsBinding.inflate(getLayoutInflater());
    setContentView(binding.getRoot());

    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
}

/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera. In this case,
 * we just add a marker near Sydney, Australia.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;

    // Add a marker in Sydney and move the camera
    LatLng sydney = new LatLng(-34, 151);
    mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
    mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}

【问题讨论】:

    标签: java android android-fragments android-automotive


    【解决方案1】:

    Google Map 是 GAS 的一部分,它不是开源的,它是 Google 专有的。要获得访问权限,公司应与 Google 建立合作伙伴关系

    【讨论】:

    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 1970-01-01
    • 2013-03-29
    • 1970-01-01
    • 1970-01-01
    • 2020-06-26
    • 2010-12-12
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    相关资源
    最近更新 更多