hi my name is ricardo im a new programer and i have this problem
in the moment that i start the service the app close i did read the service module tutorial and i dont know what to do.
and this is my service
Thanking you in advance for the consideration you will give to my problem
in the moment that i start the service the app close i did read the service module tutorial and i dont know what to do.
B4X:
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
btn.Initialize("btn")
btn.Text="Show WebMapView"
Activity.AddView(btn,0,0,100%x,10%y)
'mapv.Initialize(Activity,Me,"OK","Cancel","48.8567","2.3508","mapview","Drag the marker to set your location")
mapv.Initialize(Activity,Me,"OK","Cancel","48.8567","2.3508","mapview","Drag the marker to set your location","15","google.maps.MapTypeId.ROADMAP")
StartService(trabajo11)
End Sub
and this is my service
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim notifi As Notification
Dim URL As String
URL = "http://richsappforpymes.one/pageq.php"
Dim job1 As HttpJob
Dim query1 As String = "SELECT `mastercode` FROM `mastercode` WHERE 1"
Dim mastercode As Int
End Sub
Sub Service_Create
notifi.Initialize
notifi.Icon="icon"
job1.Initialize("job1",Me)
'notifi.SetInfo("hola como estas","aprendiendo",Main)
'notifi.Notify(2)
End Sub
Sub Service_Start (StartingIntent As Intent)
job1.PostString(URL,query1)
End Sub
Sub Service_Destroy
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Select Job.JobName
Case "job1"
'print the result to the logs
Dim parser As JSONParser
parser.Initialize(Job.GetString)
Dim datos As List
datos.Initialize
datos = parser.NextArray
Dim m As Map
m = datos.Get(0)
'idposible = m.Get("ID")
mastercode = m.Get("mastercode")
' CallSubDelayed(Main,"verifica_imei")
notifi.SetInfo("hola",mastercode,Main)
notifi.Notify(1)
End Select
Else
Log("Error: " & Job.ErrorMessage)
'ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
Thanking you in advance for the consideration you will give to my problem