Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,810,194 Members 52,378 Now Online
XDA Developers Android and Mobile Development Forum

Android widget stops reacting on events

Tip us?
 
whyte624
Old
#1  
Junior Member - OP
Thanks Meter 2
Posts: 15
Join Date: Aug 2014
Default Android widget stops reacting on events

My widget stops reacting on touch events. After installation it works fine, but after some time (couple of hours or a day) it does not react on touches. And starts to work normally after reboot or reinstallation. What could be the problem?

Repository on github with the code: whyte624/displayoffwidget
 
kalpetros
Old
(Last edited by kalpetros; 25th August 2014 at 05:32 PM.)
#2  
kalpetros's Avatar
Senior Member
Thanks Meter 29
Posts: 174
Join Date: Jul 2013
Location: 35.34, 25.13
Quote:
Originally Posted by whyte624 View Post
My widget stops reacting on touch events. After installation it works fine, but after some time (couple of hours or a day) it does not react on touches. And starts to work normally after reboot or reinstallation. What could be the problem?

Repository on github with the code: whyte624/displayoffwidget
Maybe the click event is lost when the system kills the widget's process.

Check your onUpdate method.
 
whyte624
Old
#3  
Junior Member - OP
Thanks Meter 2
Posts: 15
Join Date: Aug 2014
Quote:
Originally Posted by kalpetros View Post
Maybe the click event is lost when the system kills the widget's process.

Check your onUpdate method.
How can I do it?
If I add Toast, would it be enough?
 
whyte624
Old
#4  
Junior Member - OP
Thanks Meter 2
Posts: 15
Join Date: Aug 2014
Another problem is that widget is not visible in widgets' list on some devices, even though it is installed in device's memory.
 
kalpetros
Old
#5  
kalpetros's Avatar
Senior Member
Thanks Meter 29
Posts: 174
Join Date: Jul 2013
Location: 35.34, 25.13
Quote:
Originally Posted by whyte624 View Post
How can I do it?
If I add Toast, would it be enough?
Make sure you send all the data needed to fully reconstruct the widget every time you update it with a RemoteViews object.

Quote:
Originally Posted by whyte624 View Post
Another problem is that widget is not visible in widgets' list on some devices, even though it is installed in device's memory.
Where did you put the receiver tag?

You need to put it inside the application tag.

For example:

Code:
<manifest>
  <application>
    <receiver>
      ...
    </receiver>
  </application>
</manifest>
Then you need an activity that will appear on the launcher.

Also read this.
The Following User Says Thank You to kalpetros For This Useful Post: [ Click to Expand ]
 
whyte624
Old
#6  
Junior Member - OP
Thanks Meter 2
Posts: 15
Join Date: Aug 2014
Thank you for the response!

Quote:
Originally Posted by kalpetros View Post
Where did you put the receiver tag?
You need to put it inside the application tag.
Receiver tag is inside application tag. And RemoteViews works in the same way as it works in the post that you've pointed out.

I beleive, that process was killed by system, due to low memory. Is there a way to change widget's view, when process is killed?

And widget is not visible in list on tablets.
 
kalpetros
Old
#7  
kalpetros's Avatar
Senior Member
Thanks Meter 29
Posts: 174
Join Date: Jul 2013
Location: 35.34, 25.13
Quote:
Originally Posted by whyte624 View Post
Thank you for the response!



Receiver tag is inside application tag. And RemoteViews works in the same way as it works in the post that you've pointed out.

I beleive, that process was killed by system, due to low memory. Is there a way to change widget's view, when process is killed?

And widget is not visible in list on tablets.
Can you manually kill the service from DDMS and paste the output from logcat here?
 
whyte624
Old
#8  
Junior Member - OP
Thanks Meter 2
Posts: 15
Join Date: Aug 2014
Quote:
Originally Posted by kalpetros View Post
Can you manually kill the service from DDMS and paste the output from logcat here?
I'm not sure if I understand you correctly. I launched widget from IDE, then found it in application list (in IDE) and pressed 'stop' button. There were no output in logcat.
 
kalpetros
Old
#9  
kalpetros's Avatar
Senior Member
Thanks Meter 29
Posts: 174
Join Date: Jul 2013
Location: 35.34, 25.13
Quote:
Originally Posted by whyte624 View Post
I'm not sure if I understand you correctly. I launched widget from IDE, then found it in application list (in IDE) and pressed 'stop' button. There were no output in logcat.
See this.

Thread Tools
Display Modes


Android L Will Have Data Encryption Turned On by Default

Android L, once it is eventually released, will featuredata encryption turned on by … more

Lock Apps and Functions Easily with Droid Protector

Access and security are some of the key issues facingmobile technology. Whether … more

ARChon Lets You Run Android Apps in Google Chrome Browser

Not too long ago, Google added the ability torun select Android applications on … more

Flyme OS Finds Its Way to the Google Nexus 5

Flyme OS is a heavily modified Android variantdeveloped by the Meizu team for their MX … more