Ciao a tutti,
sto cercando di avere informazioni sul segnale gsm e le famose tacche, sono partita dall'esempio che ho trovato sul forum e inizialmente non funzionava ... ieri non so come sono riuscita a farlo partire e riuscivo a vedere la stringa "signalStrength" con tutte le info, oggi non va più..non capisco qual'è il problema di questa libreria...ho provato diversi esempi ma non riesco a capire...qualcuno ha dei suggerimenti?
Ecco il main
Ecco il service
sto cercando di avere informazioni sul segnale gsm e le famose tacche, sono partita dall'esempio che ho trovato sul forum e inizialmente non funzionava ... ieri non so come sono riuscita a farlo partire e riuscivo a vedere la stringa "signalStrength" con tutte le info, oggi non va più..non capisco qual'è il problema di questa libreria...ho provato diversi esempi ma non riesco a capire...qualcuno ha dei suggerimenti?
Ecco il main
#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: PhoneStateListener
#VersionCode: 1
#VersionName:
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#BridgeLogger : True
#End Region
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.AddMenuItem("Start","mnuStart")
Activity.AddMenuItem("Stop","mnuStop")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub mnuStart_Click
StartService(Listener)
End Sub
Sub mnuStop_Click
StopService(Listener)
Listener.PSL.stopListening
End Sub
Ecco il service
#Region Module Attributes
#StartAtBoot: False
#End Region
'Service module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
'Declares the phone state listener
Dim PSL As PhoneStateListener
End Sub
Sub Service_Create
'Initializes the PhoneStateListener.
'All data is also outputted to the filtered log field.
PSL.Initialize("PSL",True)
'Starts listening
PSL.startListeningForEvent(PSL.LISTEN_DATA_ACTIVITY)
'Remember: Find all information about the returns here:
' http://developer.android.com/reference/android/telephony/PhoneStateListener.html
End Sub
Sub Service_Start (StartingIntent As Intent)
End Sub
Sub Service_Destroy
End Sub
' Callback invoked when the call-forwarding indicator changes.
Sub PSL_onCallForwardingIndicatorChanged(cfi As Boolean)
End Sub
'Callback invoked when device call state changes.
'Idle = 0
'Ringing = 1
'OFFHook = 2
Sub PSL_onCallStateChanged (State As Int, incomingNumber As String)
End Sub
' Callback invoked when device cell location changes.
Sub PSL_onCellLocationChanged(Location As String)
End Sub
'Callback invoked when data activity state changes.
Sub PSL_onDataActivity(Direction As Int, strDirection As String)
ToastMessageShow(strDirection,False)
End Sub
'Callback invoked when connection state changes.
Sub PSL_onDataConnectionStateChanged(state As Int, Connectionstate As String)
End Sub
'Callback invoked when the message-waiting indicator changes.
Sub PSL_onMessageWaitingIndicatorChanged(mwi As Boolean)
End Sub
'Callback invoked when device service state changes.
Sub PSL_onServiceStateChanged(State As Int, strState As String)
End Sub
'Callback invoked when network signal strengths changes.
'you can use getCDma, etc to get the network connection.
Sub PSL_onSignalStrengthsChanged (signalStrength As String)
ToastMessageShow(signalStrength, False)
ToastMessageShow(PSL.CdmaDbm, False)
Log(signalStrength)
End Sub
'Remember: Find all information about the returns here:
' http://developer.android.com/reference/android/telephony/PhoneStateListener.html