Thank you for reading my question, please read it patiently. The scenario is bit different than normal Android application.
I am creating my own launcher for Android TV. I have complete permission to run my application as system app.
I have my own launcher in which I am placing widgets. In Android generally we place widgets by dragging and dropping on home screen, but in my case I have to place all widgets as soon as launcher starts. I am able to place all widgets successfully. User is not allowed to change widgets positions or not allowed to remove any widgets. All widgets are fixed.
Now requirement is something like this,
For Android TV, I have remote control to access all widgets and apps etc. Instead of touch screen I have remote to access everything.
On Home Screen/Launcher where I have all widgets, I need to implement spatial navigation. i.e I have to navigate through all widgets through remote left/ right/ up/ down key.
As a solution, I have done following things:
I have handled onFocusChangeListener to listen to focus change event and I have also handled onClickListener to handle onClick event.
On focus change and on click I am sending broadcast to each widget, along with extra data i.e. got_focus, lost_focus or clicked. In each widget I have a receiver which receives broadcast and according to whatever state, widget changes its background image. I have put Log in each of my receiver. All receivers receives their respective broadcasts, but the problem is the behavior of changing the state is not consistent. Sometimes widgets changes the states, but sometimes they don't, even they receives broadcast.
So, I want to know is there any other way to make this behavior consistent. Anybody who has worked on launcher and has come across the same scenario, please help me. I am stuck on this part from past 3 days. Is there any other way to update widgets background image from launcher.
Thanks for reading it patiently. Any kind of help will be appreciated.
Thanks again.