Awareness API とは何ですか?
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Google Awareness API を使用すると、ユーザーの現在の状況にアプリがインテリジェントに反応するようにできます。Awareness API は、ユーザー アクティビティや近くのビーコンを含む、5 つのコンテキスト タイプを公開します。これらのタイプを使用すると、従来は不可能だった方法で、アプリのユーザー エクスペリエンスを改善できます。アプリはこれらのコンテキスト シグナルを組み合わせてユーザーの現在の状況を推定し、その情報を使用してカスタマイズされたエクスペリエンス(ユーザーがヘッドフォンを接続してジョギングを始めたときにプレイリストの候補を表示するなど)を提供できます。
Awareness API のメリット
Awareness API には次のようなメリットがあります。
- 実装の容易さ: アプリに追加する API は 1 つだけです。これにより、統合が大幅に簡素化され、生産性が向上します。
- コンテキスト データの質の向上: 元のシグナルが処理され、品質が向上します。たとえば、高度なアルゴリズムを使用して、ユーザーのアクティビティを高い精度で特定します。
- 最適なシステムの状態: Awareness API は、バッテリー駆動時間とデータ使用量への影響を自動的に管理するため、アプリが管理する必要はありません。
フェンスとスナップショット
Awareness API は、アプリがコンテキスト シグナルを取得してユーザーの現在の状況を判断するために使用できる 2 つの API で構成されています。
- Fence API: この API を使用すると、アプリはユーザーの現在の状況に応答し、コンテキスト条件の組み合わせが満たされたときに通知を送信できます。たとえば、ユーザーがウォーキング中にヘッドフォンを接続している場合などです。フェンスを登録すると、Fence API はアプリが実行されていない場合でもアプリにコールバックを送信できます。
- Snapshot API: この API を使用すると、アプリはユーザーの現在のコンテキストに関する情報(ユーザーの現在地や現在の天候など)をリクエストできます。
コンテキストの種類
コンテキストは Awareness API の中核です。コンテキスト データには、位置情報(緯度と経度)、場所の種類(公園やコーヒーショップなど)、アクティビティ(ウォーキングやドライブなど)など、センサーから得られたデータが含まれます。これらの基本的なタイプ(シグナル)を組み合わせることで、ユーザーの状況をより詳細に推測できます。サポートが終了したコンテキスト シグナルを確認するには、次の通知を開いてください。
サポート終了のお知らせ: プレイスと天気のコンテキスト シグナル
次の表に、Awareness API で現在提供されている基本的なコンテキスト タイプを示します。
コンテキストの種類 |
例 |
時間 |
現在の現地時間 |
場所 |
緯度と経度 |
アクティビティ |
検出されたユーザー アクティビティ(ウォーキング、ランニング、サイクリングなど) |
ビーコン |
指定された Namespace に一致する近くのビーコン |
ヘッドフォン |
ヘッドフォンが接続されているかどうかのステータス |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-31 UTC。
[null,null,["最終更新日 2025-08-31 UTC。"],[[["\u003cp\u003eThe Google Awareness API lets your app intelligently respond to the user's context, such as their activity, location, and nearby beacons.\u003c/p\u003e\n"],["\u003cp\u003eIt offers benefits like easy implementation, improved context data quality, and automatic management of system resources.\u003c/p\u003e\n"],["\u003cp\u003eThe API provides two ways to access context: the Fence API for reacting to situations and the Snapshot API for requesting current information.\u003c/p\u003e\n"],["\u003cp\u003eSupported context types include time, location, activity, beacons, and headphone status, while places and weather signals are deprecated.\u003c/p\u003e\n"]]],[],null,["# What's the Awareness API?\n\nWith the Google Awareness API, you can enable your app to intelligently react to the\nuser's current situation. The Awareness API exposes five different\n[context types](#context-types), which include user activity,\nand nearby beacons. These types enable your app to refine the user experience in\nnew ways that weren't possible before. Your app can combine these context\nsignals to make inferences about the user's current situation, and use this\ninformation to provide customized experiences, such as a playlist suggestion\nwhen the user plugs in their headphones and starts to jog.\n\nAwareness API benefits\n----------------------\n\nThe Awareness API provides several benefits:\n\n- **Ease of implementation:** You only need to add a single API to your app, which greatly simplifies integration and improves your productivity.\n- **Better context data:** Raw signals are processed for improved quality. For example, advanced algorithms are used to determine the user's activity with a high level of accuracy.\n- **Optimal system health:** The Awareness API automatically manages its impact on battery life and data usage so that your app doesn't have to.\n\nFences and snapshots\n--------------------\n\nThe Awareness API consists of two distinct APIs that your app can use to\nget context signals in order to determine the user's current situation:\n\n- [**Fence API:**](/awareness/android-api/fence-api-overview) This API lets your app react to the user's current situation, and provides notification when a combination of context conditions are met. For example, whenever the user takes a walk and their headphones are plugged in. Once a fence is registered, the Fence API can send callbacks to your app even when it's not running.\n- [**Snapshot API:**](/awareness/android-api/snapshot-api-overview) This API lets your app request information about the user's current context, such as the user's current location and the current weather conditions.\n\nContext types\n-------------\n\nContext is at the heart of the Awareness API. Contextual data includes\nsensor-derived data such as location (latitude and longitude), place type,\nlike a park or coffee shop, and activity, such as a walk or drive. These basic\ntypes, or signals, can be combined to extrapolate the user's situation in more\nspecific detail. Expand the following notice to see which contextual signals\nhave been deprecated.\n**Deprecation notice: Places and Weather contextual signals** **Warning:**\n| The Places and Weather contextual signals, exposed by the\n| [`getPlaces()`](/android/reference/com/google/android/gms/awareness/SnapshotClient#getPlaces()), and\n| [`getWeather()`](/android/reference/com/google/android/gms/awareness/SnapshotClient#getWeather())\n| methods, were deprecated.\n|\n| - The Places contextual signal was turned off. Continued use of this signal was restricted to customers with existing implementations, through October 30, 2019. New implementations must use the [Places SDK for Android](/places/android-sdk) instead of the Places contextual signal.\n| - The Weather contextual signal has also been turned off. Continued use of this signal has been restricted to customers with existing implementations, through January 31, 2020. Google doesn't offer alternative functionality for the Weather contextual signal.\n\nThe following table describes the basic context types currently offered by\nthe Awareness API:\n\n| Context type | Example |\n|--------------|----------------------------------------------------------|\n| Time | Current local time |\n| Location | Latitude and longitude |\n| Activity | Detected user activity, like walking, running, or biking |\n| Beacons | Nearby beacons that match the specified namespace |\n| Headphones | Status of whether headphones are plugged in, or not |"]]