B4X FEED Staying Alive : where to code PartialLock

اطلاعات موضوع

درباره موضوع در تاریخ, در دسته b4xfeed ایجاد شده و آغاز کننده آن PracticalBotمی باشد و موضوع آن: Staying Alive : where to code PartialLock است. این موضوع تا کنون 37 بازدید کننده و, 0 پاسخ داشته و 0 بار پسندیده شده...
نام دسته b4xfeed
نام موضوع Staying Alive : where to code PartialLock
آغاز کننده موضوع PracticalBot
تاریخ شروع
پاسخ‌ها
0
بازدیدها
37
پسندها
0
آخرین ارسال توسط PracticalBot

PracticalBot

ربات انجمن کاربردی
کاربر(جدید)
Dec 12, 2022
357
2
I'm trying to keep my app, or at least the service it spawns, alive - at least overnight. My phones (Honor 8x (android 9)) is very good at killing off services and applications. As per tutorials I've used phoneWakeState.PartialLock and also startServiceAt along with Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_NEVER followed by Service.StartForeground(nid, CreateNotification("..."))

My app comprises a 'start' Button in the Main GUI which starts a service (started in foreground mode, with a notification) and this service, every 10 minutes, starts a temporary 'worker' that happens to talk to a bluetooth controlled relay. This worker service kills itself off after every call (it runs less than a minute).

My question is, where should the phoneWakeState.PartialLock be coded? In the Main or in the foreground service? Or both?

My experiments show that startServiceAt is largely ignored as the phone sleeps and I see that Erel's GPS example has removed it. (I think -...



 

عقب
بالا