简体   繁体   中英

android sony smartwatch 2 control led not working

I'm developing Sony smart watch extension and need to control over led. I have implemented active low power mode so watch back light can never go off. SO far its working good. But now i need to light the led when new data come from mobile app to watch. I am able to have that data in watch but at the same time i want to light the back light ON. I searched on official documentation and come to know about CONTROl_LED_INTENT in this link

I am calling this snippet at the time of data insertion

Intent intent = new Intent(Control.Intents. CONTROL_LED_INTENT); intent.putExtra(Control.Intents.EXTRA_ON_DURATION, 20); intent.putExtra(Control.Intents.EXTRA_OFF_DURATION, 50); intent.putExtra(Control.Intents.EXTRA_REPEATS, 2); intent.putExtra(Control.Intents.EXTRA_LED_COLOR, 1);

sendToHostApp(intent);

but not able to turn light on. How can i make light on.

You can set the screen state to SCREEN_STATE_AUTO or SCREEN_STATE_ON as per the API References which effectively switches on the backlight of the screen.

https://developer.sony.com/reference/sony-addon-sdk/com/sonyericsson/extras/liveware/extension/util/control/ControlExtension#setScreenState(int)

An example of a snippet with this

Intent intent = new Intent(Control.Intents.CONTROL_SET_SCREEN_STATE_INTENT);
intent.putExtra(Control.Intents.EXTRA_SCREEN_STATE, Control.Intents.SCREEN_STATE_AUTO);
sendToHostApp(intent);

Try a longer value. 20 milliseconds is 2 hundredths of a second. You may not be able to see it or the hardware may not be able to do that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM