Taylor Chapman Member Licensed User Longtime User Jul 7, 2014 #1 Hi there, I am currently running bluetooth using asyncStreams. Whenever the user minimizes the application (ex. returns to the home screen) and then goes back into it, the bluetooth connection seems to terminate. Is this the expected behavior? EDIT: It's probably worth mentioning that I am running the connection in a service. Thanks! Taylor Last edited: Jul 7, 2014
Hi there, I am currently running bluetooth using asyncStreams. Whenever the user minimizes the application (ex. returns to the home screen) and then goes back into it, the bluetooth connection seems to terminate. Is this the expected behavior? EDIT: It's probably worth mentioning that I am running the connection in a service. Thanks! Taylor
Erel B4X founder Staff member Licensed User Longtime User Jul 8, 2014 #2 Android can kill the process when the app is in the background. You can call Service.StartForeground to prevent it. Upvote 0
Android can kill the process when the app is in the background. You can call Service.StartForeground to prevent it.
Taylor Chapman Member Licensed User Longtime User Jul 11, 2014 #3 Hi Erel, thanks for your reply! I've added the following to Sub Service_Create Code: Copy nNotify.Initialize 'nNotify.Icon = "logoCut.png" nNotify.Icon = "logoCut" nNotify.SetInfo("Bent Remote", "Tap to open.", Null) nNotify.Sound=False nNotify.Vibrate=False nNotify.Light=False nNotify.OnGoingEvent=True Service.StartForeground(1,nNotify) However whenever the user closes the application, Sub AStreams_Terminated runs and the connection is closed. Any ideas as to why this might be? Thanks, Taylor Upvote 0
Hi Erel, thanks for your reply! I've added the following to Sub Service_Create Code: Copy nNotify.Initialize 'nNotify.Icon = "logoCut.png" nNotify.Icon = "logoCut" nNotify.SetInfo("Bent Remote", "Tap to open.", Null) nNotify.Sound=False nNotify.Vibrate=False nNotify.Light=False nNotify.OnGoingEvent=True Service.StartForeground(1,nNotify) However whenever the user closes the application, Sub AStreams_Terminated runs and the connection is closed. Any ideas as to why this might be? Thanks, Taylor
Erel B4X founder Staff member Licensed User Longtime User Jul 13, 2014 #4 How are you closing the app? Upvote 0
Taylor Chapman Member Licensed User Longtime User Jul 13, 2014 #5 By clicking the "home screen" button on the tablet. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jul 14, 2014 #6 Make sure that it is not your code that closes the connection. The connection should not break in this case. Upvote 0
Make sure that it is not your code that closes the connection. The connection should not break in this case.
Taylor Chapman Member Licensed User Longtime User Jul 17, 2014 #7 I've noticed that the service doesn't appear in the Android tablet status bar - is it supposed to? If so, any ideas as to why it wouldn't appear? Thanks Upvote 0
I've noticed that the service doesn't appear in the Android tablet status bar - is it supposed to? If so, any ideas as to why it wouldn't appear? Thanks
Erel B4X founder Staff member Licensed User Longtime User Jul 18, 2014 #8 It should show after you call Service.StartForeground. Upvote 0