Sorry for late reply, been away a while from PC.
Found the problem, my mistake, put the code to start service like this
Sub Activity_Create(FirstTime As Boolean)
StartService(myService)
Activity.Finish
End Sub
Change the code to this
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
StartService(myService)
End If
Activity.Finish
End Sub
Don't know if is that the right solution, but seem worked just expected.
Now the next issue
I change codes that cause a bug into like this
Sub Activity_Resume
Dim In As Intent
In = Activity.GetStartingIntent
If In <> Null Then
If In.HasExtra("StopService") Then
StopService(myService)
CancelScheduledService(myService)
Dim PUB_Nt As Notification
PUB_Nt.Initialize
PUB_Nt.Icon = "icon"
PUB_Nt.Light = True
PUB_Nt.Vibrate = False
PUB_Nt.AutoCancel = True
PUB_Nt.SetInfo("Info","Listening Service Stopped!", "")
PUB_Nt.Notify(1)
Dim returnIntent As Intent
returnIntent.Initialize(In.GetExtra("Callback"),"")
returnIntent.AddCategory("android.intent.category.DEFAULT")
returnIntent.PutExtra("Successful","True")
StartActivity(returnIntent)
End If
End If
End Sub
Is that the right correction? With those codes, I didn't see any error in the log window.
I made this code to stop running service in other app
Dim In As Intent
In.Initialize("gsf.AppthatHasService.REQUEST","")
In.AddCategory("android.intent.category.DEFAULT")
In.PutExtra("Callback","gsf.ApptoStopService.CALLBACK")
In.PutExtra("StopService","True")
StartActivity(In)
When those codes called, screen blink for a while, notification shows up, tell service has stopped, and then back to the caller app.
But when I clicked notification icon, my caller app disappear, just like users pressed Back /Home button. Is this related to bug you said before?