Android Question Running background service even in sleep mode

Reids

Member
Licensed User
Longtime User
Hello I just creating chat apps, the apps work fine when activity still active, or when user clicked back button message still can be arrived, but if user kill apps with taskmanager (holding home button and swipe it) the apps is killed and service won't start again so message won't arrive anymore

how I can handle this?

summary :
** Activity (main) Create, isFirst = true ** >>> message still can arrived
** Activity (main) Create, isFirst = false** >>> message still cannot arrived


I tried to use
B4X:
Sub Activity_Pause (UserClosed As Boolean)
    If UserClosed Then
    Log("main is paused")
    StartService(PushService)
    CallSubDelayed(PushService, "ReconnectTimer_Tick")
    Awake.ReleaseKeepAlive
    End If
End Sub

service still not executed :(
anybody can help?
 

Reids

Member
Licensed User
Longtime User
Hi erel, sorry about my post before on other thread, I finally solve the problem, it is because some parameter couldn't be passed from activity to service
now the apps work well thank you very much!
 
Upvote 0
Top