Android Question Start Service

taylorw

Active Member
Licensed User
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?
 

Star-Dust

Expert
Licensed User
Longtime User
Yes
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Try. But I'm not sure you can not kill unless you put a notify ... even empty

But you can try it
 
Upvote 0

taylorw

Active Member
Licensed User
I already try, but when i clear ram the notify will be close.
This is where i put START_STICKY, is it correct?
B4X:
#Region  Service Attributes
    #StartAtBoot: True
    #StartCommandReturnValue: android.app.Service.START_STICKY
#End Region
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Did you do something like that in the service?

B4X:
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

taylorw

Active Member
Licensed User
Yes, i have do it.

B4X:
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

Star-Dust

Expert
Licensed User
Longtime User
It seems all right
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
At the moment I have no answer. In the afternoon I can take a look, unfortunately now I have to go ...
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
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

taylorw

Active Member
Licensed User
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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…