The Awareness API gives you the power to react to changes in a user's context, but with this great power comes great responsibility! In order to provide an optimal experience for your users, consider the following guidelines.
- Be mindful of user expectations
- Be sure the user understands what to expect from your app. For example, say your app is designed to instantly play music when the user plugs in their headphones. This could result in a bad experience if the user is not expecting such behavior.
- Be conservative with notifications
- If your app sends notifications, clearly communicate this to the user. Send only notifications that are relevant to the user. Keep in mind that your app must co-exist with many other apps that may also be sending notifications.
- Conserve system health
- Although great effort has gone into making the Awareness API efficient, it still has the potential to consume significant amounts of battery if used carelessly. The Awareness API manages system health for you, however if you register too many fences the Awareness API will throttle callbacks to prevent undue battery drain. Likewise, making excessive snapshot requests can also drain battery life.
- Use the Awareness API for awareness
- If your app needs to perform tasks that are not time-sensitive, such as synchronizing data or cleanup operations, consider using the JobScheduler API for such tasks.