この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

ロケーションの追跡

エンゲージメント Mobile SDK 用の Data Cloud モジュールでは、すべてのイベントでロケーションを追跡できます。この機能を有効化するには、Data Cloud モジュールの setLocation メソッドを使用して coordinatesexpiresIn を設定します。
iOS
1// prepare the coordinates, use the CdpCoordinates wrapper
2let coordinates = CdpCoordinates(latitude: 54.187738, longitude: 15.554440)
3          
4// set the location coordinates and expiration time in seconds
5CdpModule.shared.setLocation(coordinates: coordinates, expiresIn: 60)
Android
1CdpSdk.requestSdk { sdk >
2    // prepare the coordinates, use the Coordinates wrapper
3    val coordinates = Coordinates(latitude = 54.187738, longitude = 15.554440)
4    
5    // set the location coordinates and expiration time in seconds
6    sdk.setLocation(coordinates = coordinates, expiresIn = 60) 
7}

SDK でロケーション座標の有効期限が残っている間は、イベント属性の latitude と longitude というキー名のキー値ペアに、ロケーション属性が自動的に付加されます。

有効期限が過ぎると、SDK ロケーション座標はクリアされ、イベントには付加されなくなります。座標の有効期限が過ぎる前にロケーションがイベントに付加されることを回避するには、setLocation をコールして、座標値として nil を指定します。

開発者はロケーションの追跡に関するユーザからの許可の処理、ロケーションの追跡許可の要求、ロケーションの取得、必要な精度範囲の確保を行う必要があります。

メモ