获取 Android Consumer SDK
如需在 Android 消费者应用中分享按需行程的历程,请使用 Consumer SDK。如需详细了解如何使用 Consumer SDK 跟踪行程,请参阅在 Android 中跟踪行程。
如需为 Android 消费者应用设置 Consumer SDK,请按以下步骤操作:
- 查看最低系统要求
- 获取消费者 SDK
- 配置 Google Cloud 控制台项目
- 获取身份验证令牌
- 初始化消费者 SDK
查看最低系统要求
请参阅版本说明,了解您所用消费者 SDK 版本的最低要求。请参阅版本说明。
如需使用 Consumer SDK:您的应用必须以 minSdkVersion
23 或更高版本为目标平台。
如需运行使用 Consumer SDK 的应用:Android 移动设备必须满足以下最低要求:
从 Google Maven 制品库中获取使用方 SDK
从 Google Maven 制品库中获取 2.1.0 及更高版本的消费者 SDK。
之前使用的私有代码库渠道已废弃。
Gradle
请将以下内容添加到 build.gradle
文件:
repositories {
...
google()
}
Maven
请将以下内容添加到 pom.xml
文件:
<project>
...
<repositories>
<repository>
<id>google-maven-repository</id>
<url>https://maven.google.com</url>
</repository>
</repositories>
...
</project>
后续步骤
配置 Google Cloud 控制台项目
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-01-14。
[null,null,["最后更新时间 (UTC):2025-01-14。"],[[["The Google Maps Platform Consumer SDK enables journey sharing for on-demand trips in Android consumer apps."],["Android apps using the SDK must target minSdkVersion 23 or higher and have Google Play services installed."],["The Consumer SDK can be obtained from the Google Maven repository (versions 2.1.0 and later)."],["Before implementing, ensure the device meets minimum requirements including Android 6.0 (API level 23) or later."],["Next steps include configuring a Google Cloud Console project and obtaining authentication tokens."]]],["To share on-demand journeys in Android apps, utilize the Consumer SDK. First, verify the minimum system requirements, which include Android 6.0 (API level 23) or later, and Google Play services. Next, retrieve the Consumer SDK (version 2.1.0 or later) from the Google Maven repository by modifying the `build.gradle` or `pom.xml` file to include the Google repository. Finally, configure a Google Cloud console project. Authentication and SDK initialization are also required.\n"]]