My app needs to check a site periodically.Works beautifully on the phone in debug mode. even if the screen is off.but it doesn't work when running the application outside of debug.Is there a solution for this?
gakkos What platform are you working on?
Now i noticed something. While the phone is charging, the application continues to run very well in the background.
It stops when you unplug it. When I plug it in again, it automatically continues to work without doing anything.
This sounds fairly normal, your application is getting suspended in the background. This is normal to conserve battery etc.
What exactly are you attempting to achieve? Periodic polling on mobile devices is generally considered bad practice.
I check a website every minute and if there is a change, I will notify the user by sound.
Is there any other way to solve this problem? if I use the sockets, it is still suspended in the background.
Probably would suggest you look into push notifications for a feature like that.
Your web application can send notifications directly to your user and you won't have to rely on polling.
Yes you have to check push notifications to do it properly. You can "deactivate" the power saving mode for the app but is not easy for the user and will cause problems sooner than later ( system updates can override your settings ) so push is the way to go.