0

I have a Problem with my Sony SmartWatch App. I've developed a widget with control, but after the App is installed by users on the device the scheduled refresh task of the widget starts automatically. This means the refresh task is running all the time, even if the user did not turn on SmartWatch Display or start the widget. This drains the battery. If I go to the widget screen and then turn the display from off, the scheduled Task stops like expected. But if I don't do this the task is running and running and running.... How can I detect if the Display is on and the widget is running?

Thank you very much!

P.S.: It makes no difference if the "Activate Widget" preference is checked or not....

EDIT: I've found out that the widget sourcecode does not fire if I uncheck the "Display as Widget" Checkbox in preferences. This means if the refresh schedule is running and I uncheck this box, the onDestroy is never called and so the cancel schedule also not....

user980175
  • 21
  • 1
  • 4

1 Answers1

1

Thank you - I think you have uncovered a bad behavior by the SmartWatch host application, or in other terms, a bug.

When installed, the host application sends a START_REFRESH_IMAGE_REQUEST to be able to cache information about the widget. However, it does not call STOP_REFRESH_IMAGE_REQUEST, which it probably should. This needs be investigated.

While we are investigating this bad behavior, you should try to find a workaround to solve the problem. E.g. you could have a global static variable, or a SharedPreference, that is used to track when the first START_REFRESH-signal is sent, and thus be able to stop the refresh cycle.

Thanks again, and sorry.

I will post again in this thread when I know more about fixing the problem.

Jerker
  • 805
  • 4
  • 9