Keeping your application active on a Wear device
When we write an application for contexts, we need to do certain alternatives. We know that when not using the application, we should make that app to sleep in Wear devices for better battery performance, but when we are building an application for maps, it is necessary that maps be visible and active for the user.
Android has a simple configuration for this: a method with few lines that activates the ambient mode:
//oncreate Method setAmbientEnabled();
This starts the ambient mode on the map. The API swaps to a non-interactive and low-color rendering of the map when the user is no longer actively using the app:
@Override public void onEnterAmbient(Bundle ambientDetails) { super.onEnterAmbient(ambientDetails); mMapFragment.onEnterAmbient(ambientDetails); }
The following code exits the ambient mode on the WearMap. The API swaps to the normal rendering of the map when the user starts actively using the app:
@Override public void onEnterAmbient...