Android Question Terminating WebSocket PushService Properly

iCAB

Well-Known Member
Licensed User
I am facing some difficulties after adding Websocket Push Services code to my application. I particular
I started getting "Unfortunately ProgramName has stopped" after terminating the app.
The issue is due to some uninitialized variables that are being access by the Service ( please note that there is no issue while the application is running as all these variables are initialized proper during run time ).
I am not sure what I am doing wrong in here, but here is what I have done so far to terminate the service when the application is terminated

Code:
#Region Service Attributes#StartAtBoot: false#StartCommandReturnValue: android.app.Service.START_STICKY#End Region
Code:
Sub Activity_DestroyTry
StopService(WSPushService)Log( "destroyed" )
Catch
Log(LastException)
EndTry
End Sub
I have also commented out: StartServiceAt in Service_Start
 

iCAB

Well-Known Member
Licensed User
The perfect scenario will be to receive push notifications when the app is in the background, but not after it is terminated by the user.
Once the user closes the app, I don't want to receive the messages in this particular app.
 
Top