[WM] - App (APK) gets suspended...

Startbeitrag von Yogi Yang am 29.08.2016 14:14

Hello,

I a mobile app (APK) that I have developed.

I am using a back ground thread that will fetch data from remote server using web services and save the data locally.

But this process of fetching of data gets suspended if the phone screen is locked.

Why this happens?

How to prevent the thread from getting suspended even when the phone screen is shut down or the phone is locked?

TIA

Yogi Yang

Antworten:

Hi Yogi,

This is expected behavior from Android. You need special permissions to do that.

Look at this: http://stackoverflow.com/questions/5345344/app-seems-to-stop-working-when-the-screen-goes-to-sleep

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 29.08.2016 14:17
Hello Alex,

Thanks for the link. But how to implement this in WM?

TIA

Yogi Yang

von Yogi Yang - am 29.08.2016 14:37
Hello Yogi,

I never needed that in the past, but... Check the WiFiActivate() function in WM. If you se this function it will automatically add this permission and it will also allow you to have feedback on the Wifi status. Maybe just using this option, because you want wifi feedback, will just do what you want.

Otherwise, send a small call to the free technical support on how this can be implemented easily. (I guess that simply adding the WAKE_LOCK permission to your android project will not be sufficient (??). You can simply try that option very quickly when you compile your APK. There is a screen to add permissions.)

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 29.08.2016 14:49
Hi Yogi,

I forgot to mention that in WM you can add some java code directly. So you could call the required functions quite easily. Just do not forget to add the permission when you build your apk.

http://doc.windev.com/en-US/?9000011

Kind regards,
Alexandre Leclerc

von Alexandre Leclerc - am 29.08.2016 14:53
Hi. The normal android threads are paused when the app go to second plane.

Do you have tried using a Persistent Thread? It will stay running with app in second plane or sleeping.

Rubén

von Ruben Sanchez Peña - am 29.08.2016 14:58
Hello Alex,

Thank for your suggestions. I think I will be able to solve my problem using your suggestion. It will experiment as per your suggestions and see what are the possibilities.

TIA

Yogi Yang

von Yogi Yang - am 07.09.2016 06:50
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.