T taylorw Active Member Licensed User Aug 2, 2017 #1 Hi all, i need run a service at background and when user is close app or clear ram but service still running at background, is it possible?
Hi all, i need run a service at background and when user is close app or clear ram but service still running at background, is it possible?
DonManfred Expert Licensed User Longtime User Aug 2, 2017 #4 https://www.b4x.com/android/forum/t...-service-long-running-background-tasks.27065/ Upvote 0
Star-Dust Expert Licensed User Longtime User Aug 2, 2017 #5 1) Set this attribute: #StartCommandReturnValue: android.app.Service.START_STICKY see: https://www.b4x.com/android/forum/t...-long-running-background-tasks.27065/#content 2) Start service with: Service.StartForeground 3) Add Notify Upvote 0
1) Set this attribute: #StartCommandReturnValue: android.app.Service.START_STICKY see: https://www.b4x.com/android/forum/t...-long-running-background-tasks.27065/#content 2) Start service with: Service.StartForeground 3) Add Notify
Star-Dust Expert Licensed User Longtime User Aug 2, 2017 #7 Try. But I'm not sure you can not kill unless you put a notify ... even empty But you can try it Upvote 0
DonManfred Expert Licensed User Longtime User Aug 2, 2017 #8 taylorw said: If i don't want notify can do this? Click to expand... Then you can not use a Sticky Service. A Sticky service must show a Notificationicon (as far as i know). The Sticky prevents Android from killing your Service. Upvote 0
taylorw said: If i don't want notify can do this? Click to expand... Then you can not use a Sticky Service. A Sticky service must show a Notificationicon (as far as i know). The Sticky prevents Android from killing your Service.
T taylorw Active Member Licensed User Aug 2, 2017 #9 Oh i see, thank you Star-Dust and DonManfred. I will try it. Upvote 0
T taylorw Active Member Licensed User Aug 2, 2017 #10 I already try, but when i clear ram the notify will be close. This is where i put START_STICKY, is it correct? Code: Copy #Region Service Attributes #StartAtBoot: True #StartCommandReturnValue: android.app.Service.START_STICKY #End Region Upvote 0
I already try, but when i clear ram the notify will be close. This is where i put START_STICKY, is it correct? Code: Copy #Region Service Attributes #StartAtBoot: True #StartCommandReturnValue: android.app.Service.START_STICKY #End Region
Star-Dust Expert Licensed User Longtime User Aug 2, 2017 #11 Did you do something like that in the service? Code: Copy Dim n As Notification Sub Service_Create n.Initialize n.Icon = "icon" n.Vibrate = False n.Sound = False n.Light = False n.OnGoingEvent=True n.SetInfo("", "",Main) n.Notify(1) Service.StartForeground(1, n) End Sub Upvote 0
Did you do something like that in the service? Code: Copy Dim n As Notification Sub Service_Create n.Initialize n.Icon = "icon" n.Vibrate = False n.Sound = False n.Light = False n.OnGoingEvent=True n.SetInfo("", "",Main) n.Notify(1) Service.StartForeground(1, n) End Sub
T taylorw Active Member Licensed User Aug 2, 2017 #12 Yes, i have do it. Code: Copy Dim n1 As Notification n1.Initialize n1.Icon = "icon" n1.Vibrate = False n1.Sound = False n1.Light = False n1.SetInfo("VegeTrade", "", Me) Service.StartForeground(1,n1) Upvote 0
Yes, i have do it. Code: Copy Dim n1 As Notification n1.Initialize n1.Icon = "icon" n1.Vibrate = False n1.Sound = False n1.Light = False n1.SetInfo("VegeTrade", "", Me) Service.StartForeground(1,n1)
T taylorw Active Member Licensed User Aug 2, 2017 #14 Yes i think so, but why it will be close? Upvote 0
Star-Dust Expert Licensed User Longtime User Aug 2, 2017 #15 At the moment I have no answer. In the afternoon I can take a look, unfortunately now I have to go ... Upvote 0
At the moment I have no answer. In the afternoon I can take a look, unfortunately now I have to go ...
T taylorw Active Member Licensed User Aug 2, 2017 #17 This is my sample project. Attachments Sample.zip Sample.zip 388.2 KB · Views: 430 Upvote 0
Star-Dust Expert Licensed User Longtime User Aug 2, 2017 #18 But what is the program to clean the ram? In my devices does not disappear .. What device do I use and what version of Android? Upvote 0
But what is the program to clean the ram? In my devices does not disappear .. What device do I use and what version of Android?
T taylorw Active Member Licensed User Aug 3, 2017 #19 Sorry about i just saw your reply. I clear ram not using app to clear. Like this original clear. My phone model number is <PLK-L01>, android version 6.0 Upvote 0
Sorry about i just saw your reply. I clear ram not using app to clear. Like this original clear. My phone model number is <PLK-L01>, android version 6.0
DonManfred Expert Licensed User Longtime User Aug 3, 2017 #20 taylorw said: clear ram not using app to clear. Like this original clear. Click to expand... This is a task-killer Upvote 0
taylorw said: clear ram not using app to clear. Like this original clear. Click to expand... This is a task-killer