I am trying to trigger some actions on an Android Wear watch face right before it goes into Ambient Mode. For activities, there is the onEnterAmbient() overrideable method, but I believe this is not the case for wallpaper services.
So, is there any way to trigger actions on a watch face right before it enters Ambient Mode?
EDIT: Especificaly, I would be looking to detect when the screen starts going dim, right before ambient mode effectively triggering.
Edited.
On the CanvasWatchFaceService:
private boolean firstAnimation;
@Override
public void onAmbientModeChanged(boolean inAmbientMode) {
super.onAmbientModeChanged(inAmbientMode);
if(inAmbientMode){
firstAnimation = false;
}
invalidate();
}
@Override
public void onDraw(Canvas canvas, Rect bounds) {
if(inAmbientMode){
if(firstAnimation){
// draw ambient mode
}else{
//draw animation and when finish the animation
//set the firstAnimation flag to true
}
}else{
//draw normal mode
}
invalidate();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With