Melakukan inisialisasi Consumer SDK
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Untuk mulai berbagi perjalanan dari Fleet Engine dan backend pelanggan,
Anda perlu menginisialisasi Consumer SDK di aplikasi iOS.
providerID
sama dengan Project ID akun Google Cloud Anda
Proyek. Untuk mengetahui informasi tentang cara menyiapkan Project Google Cloud, lihat
Buat project Fleet Engine Anda.
Contoh berikut menunjukkan cara menginisialisasi Consumer SDK di aplikasi Anda.
Swift
/*
* AppDelegate.swift
*/
import GoogleRidesharingConsumer
import GoogleMaps
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Register your API key for GMSServices.
GMSServices.provideAPIKey(yourMapsAPIKey)
// Set the instance of the SampleAccessTokenProvider.
GMTCServices.setAccessTokenProvider(SampleAccessTokenProvider(), providerID: yourProviderID)
// Other initialization code ...
return true
}
}
Objective-C
/*
* AppDelegate.m
*/
#import <GoogleMaps/GoogleMaps.h>
#import <GoogleRidesharingConsumer/GoogleRidesharingConsumer.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Register your API key for GMSServices.
[GMSServices provideAPIKey:yourMapsAPIKey];
//Set the instance of the AccessTokenFactory.
[GMTCServices setAccessTokenProvider:[[SampleAccessTokenProvider alloc] init]
providerID:yourProviderID];
// Other initialization code ...
return YES;
}
@end
Langkah Berikutnya
Menyiapkan peta
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2024-08-22 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Informasi yang saya butuhkan tidak ada"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Terlalu rumit/langkahnya terlalu banyak"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Sudah usang"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"Masalah terjemahan"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Masalah kode / contoh"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Lainnya"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Mudah dipahami"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Memecahkan masalah saya"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Lainnya"
}]
{"lastModified": "Terakhir diperbarui pada 2024-08-22 UTC."}
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2024-08-22 UTC."]]