XverhelstX Well-Known Member Licensed User Longtime User Mar 21, 2011 #1 Hello everyone, I have a question about letting your app work in the background. So I have a btnStart that will start the service: StartService(Interceptor). then I have this: B4X: Expand Collapse Copy Sub SI_MessageReceived (From As String, Body As String) Log("MessageReceived: From = " & From & ", Body = " & Body) MessageFrom1 = From MessageBody1 = Body CallSub(Main, "AfterMessageReceived") So how let I keep the activity working when you don't see it and when you receive a message, the activity opens again or something. Like the android task killer when you swipe it down on Notifications. Hope u can help me as soon as possible. thanks! xverhelstx EDIT: I managed to solve some things like working on the background where you basically just need services. but I still want to know how you can call it on the notifications and set a icon for it . Last edited: Mar 22, 2011
Hello everyone, I have a question about letting your app work in the background. So I have a btnStart that will start the service: StartService(Interceptor). then I have this: B4X: Expand Collapse Copy Sub SI_MessageReceived (From As String, Body As String) Log("MessageReceived: From = " & From & ", Body = " & Body) MessageFrom1 = From MessageBody1 = Body CallSub(Main, "AfterMessageReceived") So how let I keep the activity working when you don't see it and when you receive a message, the activity opens again or something. Like the android task killer when you swipe it down on Notifications. Hope u can help me as soon as possible. thanks! xverhelstx EDIT: I managed to solve some things like working on the background where you basically just need services. but I still want to know how you can call it on the notifications and set a icon for it .
Erel B4X founder Staff member Licensed User Longtime User Mar 23, 2011 #2 Activities are always paused when not in the foreground. You can set a notification that will start the activity. See an example in the B4A-Bridge source code: B4A-Bridge source code Upvote 0
Activities are always paused when not in the foreground. You can set a notification that will start the activity. See an example in the B4A-Bridge source code: B4A-Bridge source code