LocationManager.RequestLocationUpdates メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
オーバーロード
RequestLocationUpdates(String, LocationRequest, PendingIntent)
LocationRequestを使用して、指定されたプロバイダーからの場所の更新と、指定されたPendingIntentを介して配信されるコールバックに登録します。
[Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;Landroid/location/LocationRequest;Landroid/app/PendingIntent;)V", "GetRequestLocationUpdates_Ljava_lang_String_Landroid_location_LocationRequest_Landroid_app_PendingIntent_Handler", ApiSince=31)]
public virtual void RequestLocationUpdates(string provider, Android.Locations.LocationRequest locationRequest, Android.App.PendingIntent pendingIntent);
[<Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;Landroid/location/LocationRequest;Landroid/app/PendingIntent;)V", "GetRequestLocationUpdates_Ljava_lang_String_Landroid_location_LocationRequest_Landroid_app_PendingIntent_Handler", ApiSince=31)>]
abstract member RequestLocationUpdates : string * Android.Locations.LocationRequest * Android.App.PendingIntent -> unit
override this.RequestLocationUpdates : string * Android.Locations.LocationRequest * Android.App.PendingIntent -> unit
パラメーター
- provider
- String
プロバイダーの一覧 #getAllProviders()
- locationRequest
- LocationRequest
場所パラメーターを含む場所要求
- pendingIntent
- PendingIntent
場所の更新を送信する保留中の意図
- 属性
注釈
LocationRequestを使用して、指定されたプロバイダーからの場所の更新と、指定されたPendingIntentを介して配信されるコールバックに登録します。
配信された保留中の意図には、コールバック情報を含む追加の意図が含まれます。 エクストラに使用されるキーは #KEY_LOCATION_CHANGED され、 #KEY_PROVIDER_ENABLED。 値の詳細については、それぞれの追加キーのドキュメントを参照してください。
場所の更新の登録を解除するには、 #removeUpdates(PendingIntent)を使用します。
このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。
適用対象
RequestLocationUpdates(Int64, Single, Criteria, PendingIntent)
指定された条件で選択されたプロバイダーと、指定された PendingIntent経由で配信されるコールバックを使用して、場所の更新プログラムを登録します。
[Android.Runtime.Register("requestLocationUpdates", "(JFLandroid/location/Criteria;Landroid/app/PendingIntent;)V", "GetRequestLocationUpdates_JFLandroid_location_Criteria_Landroid_app_PendingIntent_Handler")]
public virtual void RequestLocationUpdates(long minTimeMs, float minDistanceM, Android.Locations.Criteria criteria, Android.App.PendingIntent pendingIntent);
[<Android.Runtime.Register("requestLocationUpdates", "(JFLandroid/location/Criteria;Landroid/app/PendingIntent;)V", "GetRequestLocationUpdates_JFLandroid_location_Criteria_Landroid_app_PendingIntent_Handler")>]
abstract member RequestLocationUpdates : int64 * single * Android.Locations.Criteria * Android.App.PendingIntent -> unit
override this.RequestLocationUpdates : int64 * single * Android.Locations.Criteria * Android.App.PendingIntent -> unit
パラメーター
- minTimeMs
- Int64
場所の更新間隔の最小時間間隔 (ミリ秒単位)
- minDistanceM
- Single
位置更新間の最小距離 (メートル単位)
- criteria
- Criteria
には、場所の更新に適したプロバイダーを選択するためのパラメーターが含まれています
- pendingIntent
- PendingIntent
場所の更新を送信する保留中の意図
- 属性
例外
条件が null の場合
意図が null の場合
適切なアクセス許可がない場合
注釈
指定された条件で選択されたプロバイダーと、指定された PendingIntent経由で配信されるコールバックを使用して、場所の更新プログラムを登録します。
注: Android KitKat 以降、条件要求では常に #FUSED_PROVIDERが使用されます。
このメソッドの動作の詳細については、 #requestLocationUpdates(String, long, float, PendingIntent) を参照してください。
このメンバーは非推奨です。 代わりに #requestLocationUpdates(String, long, float, PendingIntent) を使用して、プロバイダーを明示的に選択します。
このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。
適用対象
RequestLocationUpdates(String, LocationRequest, IExecutor, ILocationListener)
LocationRequestと指定したExecutorのコールバックを使用して、指定したプロバイダーからの場所の更新に登録します。
[Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;Landroid/location/LocationRequest;Ljava/util/concurrent/Executor;Landroid/location/LocationListener;)V", "GetRequestLocationUpdates_Ljava_lang_String_Landroid_location_LocationRequest_Ljava_util_concurrent_Executor_Landroid_location_LocationListener_Handler", ApiSince=31)]
public virtual void RequestLocationUpdates(string provider, Android.Locations.LocationRequest locationRequest, Java.Util.Concurrent.IExecutor executor, Android.Locations.ILocationListener listener);
[<Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;Landroid/location/LocationRequest;Ljava/util/concurrent/Executor;Landroid/location/LocationListener;)V", "GetRequestLocationUpdates_Ljava_lang_String_Landroid_location_LocationRequest_Ljava_util_concurrent_Executor_Landroid_location_LocationListener_Handler", ApiSince=31)>]
abstract member RequestLocationUpdates : string * Android.Locations.LocationRequest * Java.Util.Concurrent.IExecutor * Android.Locations.ILocationListener -> unit
override this.RequestLocationUpdates : string * Android.Locations.LocationRequest * Java.Util.Concurrent.IExecutor * Android.Locations.ILocationListener -> unit
パラメーター
- provider
- String
プロバイダーの一覧 #getAllProviders()
- locationRequest
- LocationRequest
場所パラメーターを含む場所要求
- executor
- IExecutor
リスナー コールバックを処理する Executor
- listener
- ILocationListener
場所の更新を受信するリスナー
- 属性
注釈
LocationRequestと指定したExecutorのコールバックを使用して、指定したプロバイダーからの場所の更新に登録します。
一意のリスナーとプロバイダーのペアごとに登録できる要求は 1 つだけであるため、同じプロバイダーとリスナーを持つ後続の要求は、関連付けられているすべての引数を上書きします。 同じリスナーは、プロバイダーごとに異なる要求を持つ複数のプロバイダーで使用できます。
デバイスがそれ自体を検出する条件によっては、最初の場所の更新プログラムを受信するまでに時間がかかる場合があります。 キャッシュされた場所を利用するために、アプリケーションは代わりに #getLastKnownLocation(String) または #getCurrentLocation(String, LocationRequest, CancellationSignal, Executor, Consumer) の使用を検討できます。
さまざまな要求パラメーターの説明と、それらが受信した場所に与える影響については、 LocationRequest ドキュメントを参照してください。
アプリケーションですべてのプロバイダーからの場所の更新を受動的に監視する場合は、 #PASSIVE_PROVIDERを使用します。 このプロバイダーはアクティブな場所プロバイダーをオンまたは変更しないため、最小時間と最小距離のパラメーターに注意する必要はありません。 ただし、アプリケーションが場所の更新 (ネットワーク アクティビティなど) に対して大量の作業を実行する場合は、別のアプリケーションが非常に高速な更新を使用して場所プロバイダーを有効にした場合に備えて、場所の要求に明示的に最速の間隔を設定する必要があります。
選択したプロバイダーが無効になっている場合、場所の更新は停止し、プロバイダーの可用性更新プログラムが送信されます。 プロバイダーが再度有効になるとすぐに、別のプロバイダーの可用性更新プログラムが送信され、場所の更新が再開されます。
#GPS_PROVIDERから返される位置は、デバイス内のプライマリのGNSMアンテナ位置に関して行われます。
#getGnssAntennaInfos() は、Android 座標系に関して、GPS アンテナの位置を決定し、必要に応じてそれらの間で変換するために使用できます。 これは一般に、高精度アプリケーションにのみ必要です。
場所のコールバックが呼び出されると、システムは一定期間、アプリケーションの代わりにウェイクロックを保持しますが、無期限ではありません。 アプリケーションで場所コールバック内で実行時間の長いウェイクロックが必要な場合は、自分で取得する必要があります。
場所の要求のスパミングはシステム リソースのドレインであり、システムには予防的な対策が講じられ、この動作により、同じ間隔で同じ間隔で 1 つの場所要求で達成できるよりも多くの場所が発生することがないようにします。 この改善の一環として、Android S 以上を対象とするアプリケーションは、リスナーを介してキャッシュされた場所または履歴の場所を受け取る可能性があります。 これらの場所は、場所要求の間隔よりも古くはありません。
場所の更新の登録を解除するには、 #removeUpdates(LocationListener)を使用します。
このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。
適用対象
RequestLocationUpdates(String, Int64, Single, PendingIntent)
指定されたプロバイダーと、指定された PendingIntentを介して配信されるコールバックを使用して、場所の更新に登録します。
[Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLandroid/app/PendingIntent;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLandroid_app_PendingIntent_Handler")]
public virtual void RequestLocationUpdates(string provider, long minTimeMs, float minDistanceM, Android.App.PendingIntent pendingIntent);
[<Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLandroid/app/PendingIntent;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLandroid_app_PendingIntent_Handler")>]
abstract member RequestLocationUpdates : string * int64 * single * Android.App.PendingIntent -> unit
override this.RequestLocationUpdates : string * int64 * single * Android.App.PendingIntent -> unit
パラメーター
- provider
- String
プロバイダーの一覧 #getAllProviders()
- minTimeMs
- Int64
場所の更新間隔の最小時間間隔 (ミリ秒単位)
- minDistanceM
- Single
位置更新間の最小距離 (メートル単位)
- pendingIntent
- PendingIntent
場所の更新を送信する保留中の意図
- 属性
例外
プロバイダーが null であるか、このデバイスに存在しない場合
意図が null の場合
適切なアクセス許可がない場合
注釈
指定されたプロバイダーと、指定された PendingIntentを介して配信されるコールバックを使用して、場所の更新に登録します。
このメソッドの動作の詳細については、 #requestLocationUpdates(String, LocationRequest, PendingIntent) を参照してください。
このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。
適用対象
RequestLocationUpdates(String, Int64, Single, ILocationListener)
指定された引数と呼び出し元スレッドの Looper のコールバックを使用して、指定されたプロバイダーからの場所の更新に登録します。
[Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLandroid/location/LocationListener;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLandroid_location_LocationListener_Handler")]
public virtual void RequestLocationUpdates(string provider, long minTimeMs, float minDistanceM, Android.Locations.ILocationListener listener);
[<Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLandroid/location/LocationListener;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLandroid_location_LocationListener_Handler")>]
abstract member RequestLocationUpdates : string * int64 * single * Android.Locations.ILocationListener -> unit
override this.RequestLocationUpdates : string * int64 * single * Android.Locations.ILocationListener -> unit
パラメーター
- provider
- String
プロバイダーの一覧 #getAllProviders()
- minTimeMs
- Int64
場所の更新間隔の最小時間間隔 (ミリ秒単位)
- minDistanceM
- Single
位置更新間の最小距離 (メートル単位)
- listener
- ILocationListener
場所の更新を受信するリスナー
- 属性
例外
プロバイダーが null であるか、このデバイスに存在しない場合
リスナーが null の場合
呼び出し元のスレッドに Looper がない場合
適切なアクセス許可がない場合
注釈
指定された引数と呼び出し元スレッドの Looper のコールバックを使用して、指定されたプロバイダーからの場所の更新に登録します。
このメソッドの動作の詳細については、 #requestLocationUpdates(String, LocationRequest, Executor, LocationListener) を参照してください。
Jellybean より前は、minTime パラメーターはヒントのみで、一部の場所プロバイダーの実装では無視されていました。 ただし、Jellybean 以降では、Android 互換デバイスで minTime パラメーターと minDistance パラメーターの両方を観察することが必須です。
このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。
適用対象
RequestLocationUpdates(Int64, Single, Criteria, ILocationListener, Looper)
指定した条件で選択したプロバイダーと、指定した Looperのコールバックを使用して、場所の更新プログラムを登録します。
[Android.Runtime.Register("requestLocationUpdates", "(JFLandroid/location/Criteria;Landroid/location/LocationListener;Landroid/os/Looper;)V", "GetRequestLocationUpdates_JFLandroid_location_Criteria_Landroid_location_LocationListener_Landroid_os_Looper_Handler")]
public virtual void RequestLocationUpdates(long minTimeMs, float minDistanceM, Android.Locations.Criteria criteria, Android.Locations.ILocationListener listener, Android.OS.Looper? looper);
[<Android.Runtime.Register("requestLocationUpdates", "(JFLandroid/location/Criteria;Landroid/location/LocationListener;Landroid/os/Looper;)V", "GetRequestLocationUpdates_JFLandroid_location_Criteria_Landroid_location_LocationListener_Landroid_os_Looper_Handler")>]
abstract member RequestLocationUpdates : int64 * single * Android.Locations.Criteria * Android.Locations.ILocationListener * Android.OS.Looper -> unit
override this.RequestLocationUpdates : int64 * single * Android.Locations.Criteria * Android.Locations.ILocationListener * Android.OS.Looper -> unit
パラメーター
- minTimeMs
- Int64
場所の更新間隔の最小時間間隔 (ミリ秒単位)
- minDistanceM
- Single
位置更新間の最小距離 (メートル単位)
- criteria
- Criteria
には、場所の更新に適したプロバイダーを選択するためのパラメーターが含まれています
- listener
- ILocationListener
場所の更新を受信するリスナー
- looper
- Looper
メッセージ キューを使用してコールバック メカニズムを実装する Looper オブジェクト、または呼び出し元のスレッドでコールバックを行う場合は null
- 属性
例外
条件が null の場合
リスナーが null の場合
適切なアクセス許可がない場合
注釈
指定した条件で選択したプロバイダーと、指定した Looperのコールバックを使用して、場所の更新プログラムを登録します。
注: Android KitKat 以降、条件要求では常に #FUSED_PROVIDERが使用されます。
このメソッドの動作の詳細については、 #requestLocationUpdates(String, LocationRequest, Executor, LocationListener) を参照してください。
このメンバーは非推奨です。 代わりに #requestLocationUpdates(String, long, float, LocationListener, Looper) を使用して、プロバイダーを明示的に選択します。
このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。
適用対象
RequestLocationUpdates(Int64, Single, Criteria, IExecutor, ILocationListener)
指定した条件で選択したプロバイダーと、指定した Executorのコールバックを使用して、場所の更新プログラムを登録します。
[Android.Runtime.Register("requestLocationUpdates", "(JFLandroid/location/Criteria;Ljava/util/concurrent/Executor;Landroid/location/LocationListener;)V", "GetRequestLocationUpdates_JFLandroid_location_Criteria_Ljava_util_concurrent_Executor_Landroid_location_LocationListener_Handler", ApiSince=30)]
public virtual void RequestLocationUpdates(long minTimeMs, float minDistanceM, Android.Locations.Criteria criteria, Java.Util.Concurrent.IExecutor executor, Android.Locations.ILocationListener listener);
[<Android.Runtime.Register("requestLocationUpdates", "(JFLandroid/location/Criteria;Ljava/util/concurrent/Executor;Landroid/location/LocationListener;)V", "GetRequestLocationUpdates_JFLandroid_location_Criteria_Ljava_util_concurrent_Executor_Landroid_location_LocationListener_Handler", ApiSince=30)>]
abstract member RequestLocationUpdates : int64 * single * Android.Locations.Criteria * Java.Util.Concurrent.IExecutor * Android.Locations.ILocationListener -> unit
override this.RequestLocationUpdates : int64 * single * Android.Locations.Criteria * Java.Util.Concurrent.IExecutor * Android.Locations.ILocationListener -> unit
パラメーター
- minTimeMs
- Int64
場所の更新間隔の最小時間間隔 (ミリ秒単位)
- minDistanceM
- Single
位置更新間の最小距離 (メートル単位)
- criteria
- Criteria
には、場所の更新に適したプロバイダーを選択するためのパラメーターが含まれています
- executor
- IExecutor
リスナー コールバックを処理する Executor
- listener
- ILocationListener
場所の更新を受信するリスナー
- 属性
注釈
指定した条件で選択したプロバイダーと、指定した Executorのコールバックを使用して、場所の更新プログラムを登録します。
注: Android KitKat 以降、条件要求では常に #FUSED_PROVIDERが使用されます。
このメソッドの動作の詳細については、 #requestLocationUpdates(String, LocationRequest, Executor, LocationListener) を参照してください。
このメンバーは非推奨です。 代わりに #requestLocationUpdates(String, long, float, Executor, LocationListener) を使用して、プロバイダーを明示的に選択します。
このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。
適用対象
RequestLocationUpdates(String, Int64, Single, ILocationListener, Looper)
指定された引数と指定した Looperのコールバックを使用して、指定されたプロバイダーからの場所の更新に登録します。
[Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLandroid/location/LocationListener;Landroid/os/Looper;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLandroid_location_LocationListener_Landroid_os_Looper_Handler")]
public virtual void RequestLocationUpdates(string provider, long minTimeMs, float minDistanceM, Android.Locations.ILocationListener listener, Android.OS.Looper? looper);
[<Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLandroid/location/LocationListener;Landroid/os/Looper;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLandroid_location_LocationListener_Landroid_os_Looper_Handler")>]
abstract member RequestLocationUpdates : string * int64 * single * Android.Locations.ILocationListener * Android.OS.Looper -> unit
override this.RequestLocationUpdates : string * int64 * single * Android.Locations.ILocationListener * Android.OS.Looper -> unit
パラメーター
- provider
- String
プロバイダーの一覧 #getAllProviders()
- minTimeMs
- Int64
場所の更新間隔の最小時間間隔 (ミリ秒単位)
- minDistanceM
- Single
位置更新間の最小距離 (メートル単位)
- listener
- ILocationListener
場所の更新を受信するリスナー
- looper
- Looper
呼び出し元スレッドのルーパーを使用する場合は、ルーパー処理リスナーコールバック、または null
- 属性
例外
プロバイダーが null または存在しない場合
リスナーが null の場合
適切なアクセス許可がない場合
注釈
指定された引数と指定した Looperのコールバックを使用して、指定されたプロバイダーからの場所の更新に登録します。
このメソッドの動作の詳細については、 #requestLocationUpdates(String, LocationRequest, Executor, LocationListener) を参照してください。
Jellybean より前は、minTime パラメーターはヒントのみで、一部の場所プロバイダーの実装では無視されていました。 ただし、Jellybean 以降では、Android 互換デバイスで minTime パラメーターと minDistance パラメーターの両方を観察することが必須です。
このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。
適用対象
RequestLocationUpdates(String, Int64, Single, IExecutor, ILocationListener)
名前付きプロバイダーと、指定した Executorのコールバックを使用して、場所の更新に登録します。
[Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLjava/util/concurrent/Executor;Landroid/location/LocationListener;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLjava_util_concurrent_Executor_Landroid_location_LocationListener_Handler", ApiSince=30)]
public virtual void RequestLocationUpdates(string provider, long minTimeMs, float minDistanceM, Java.Util.Concurrent.IExecutor executor, Android.Locations.ILocationListener listener);
[<Android.Runtime.Register("requestLocationUpdates", "(Ljava/lang/String;JFLjava/util/concurrent/Executor;Landroid/location/LocationListener;)V", "GetRequestLocationUpdates_Ljava_lang_String_JFLjava_util_concurrent_Executor_Landroid_location_LocationListener_Handler", ApiSince=30)>]
abstract member RequestLocationUpdates : string * int64 * single * Java.Util.Concurrent.IExecutor * Android.Locations.ILocationListener -> unit
override this.RequestLocationUpdates : string * int64 * single * Java.Util.Concurrent.IExecutor * Android.Locations.ILocationListener -> unit
パラメーター
- provider
- String
プロバイダーの一覧 #getAllProviders()
- minTimeMs
- Int64
場所の更新間隔の最小時間間隔 (ミリ秒単位)
- minDistanceM
- Single
位置更新間の最小距離 (メートル単位)
- executor
- IExecutor
リスナー コールバックを処理する Executor
- listener
- ILocationListener
場所の更新を受信するリスナー
- 属性
注釈
名前付きプロバイダーと、指定した Executorのコールバックを使用して、場所の更新に登録します。
このメソッドの動作の詳細については、 #requestLocationUpdates(String, LocationRequest, Executor, LocationListener) を参照してください。
Jellybean より前は、minTime パラメーターはヒントのみで、一部の場所プロバイダーの実装では無視されていました。 ただし、Jellybean 以降では、Android 互換デバイスで minTime パラメーターと minDistance パラメーターの両方を観察することが必須です。
このページの一部は、によって作成および共有され、に記載されている条件に従って使用される作業に基づく変更です。