Is possible LocationManager don´t runs in Jelly Bean.I try this code with ICS and Gingerbrad and all is ok but with Jelly Bean don´t runs.
B4X:
'Service module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim tiempo As Timer
Dim dat As leerdatos
Dim longitud As String
Dim latitud As String
Dim posicion As LocationManager
Dim sms1 As PhoneSms
Dim funcio As String
Dim a As PhoneId
Dim serialsim As String
Dim serialsim2 As String
Dim numerosms As Int
Dim Sms As Sms
'Dim i As Intent
End Sub
Sub Service_Create
posicion.Initialize("posicion")
End Sub
Sub Service_Start (StartingIntent As Intent)
Try
funcio=dat.funciona
serialsim=dat.ids
Catch
StartActivity(Main)
End Try
Try
If funcio="1" Then
numerosms=dat.numerollam
serialsim2=a.GetSimSerialNumber
End If
Catch
End Try
posicion.requestMobileLocation
Try
If serialsim2<> serialsim Then
' ToastMessageShow("mi serial: "&serialsim& " " &" otra: "&serialsim2,True)
tiempo.Initialize("tiempo1",7000)
tiempo.Enabled=True
End If
Catch
End Try
End Sub
Sub tiempo1_Tick
'ToastMessageShow("a ver",False)
sms1.Send(numerosms,"Tengo tu movil "&CRLF&("http://maps.google.es/maps?hl=es&q=" & latitud & ",+" & longitud) )
numerosms=numerosms+1
'ToastMessageShow("enviado",False)
tiempo.Enabled=False
End Sub
Sub posicion_LocationChanged (Longitude As Double, Latitude As Double, Altitude As Double, Accuracy As Float, Bearing As Float, Provider As String, Speed As Float, Time As Long)
latitud=Latitude
longitud=Longitude
End Sub
Sub Service_Destroy
End Sub