Hi I have the following code in a service module.
My aim to to ensure certain settings on the handset are as i require them for my app and if they are not then set them (samsung Galaxy Y)
I need to make sure GPS is activated, AirplaneMode is disabled and Data connection is activated.
So far this works great for the GPS but AirplaneMode crashes.
Anyone have any idea why ?
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			My aim to to ensure certain settings on the handset are as i require them for my app and if they are not then set them (samsung Galaxy Y)
I need to make sure GPS is activated, AirplaneMode is disabled and Data connection is activated.
So far this works great for the GPS but AirplaneMode crashes.
Anyone have any idea why ?
			
				PHP:
			
		
		
		#Region Module Attributes
   #StartAtBoot: False
#End Region
'Service module
Sub Process_Globals
        Dim PE As PhoneEvents
   Dim AC As AnswerCall
   Dim PhoneId As PhoneId
   Dim GPS1 As GPS
   Dim TGL As Toggle
End Sub
Sub Service_Create 
    PE.InitializeWithPhoneState("PE",PhoneId)
   AC.Initialize("AnswerCall")
   GPS1.Initialize("GPS")
   TGL.Initialize()
   Log("Service created")
End Sub
Sub Service_Start
   Log("Service started.")
   GPS1.Start(1000,0)
   
'   TGL.TurnGPSOn
'   TGL.TurnDataConnectionOn
'   TGL.TurnAirplaneModeOff
End Sub
Sub PE_PhoneStateChanged (State As String, IncomingNumber As String, Intent As Intent)
    Log("PhoneStateChanged, State = " & State & ", IncomingNumber = " & IncomingNumber)
    Log(Intent.ExtrasToString)
   ToastMessageShow(IncomingNumber,False)
   AC.LetPhoneRing(3)
   If AC.isRinging == True Then
      AC.AnswerPhone
   End If
   AC.enableSpeakerphone
   
End Sub
Sub PE_AirplaneModeChanged (State As Boolean, Intent As Intent)
   ToastMessageShow("AirplaneMode State " & State ,True)
   Log("AirplaneMode State " & State)
   If State = True Then
      TGL.TurnAirplaneModeOff
   End If
End Sub
Sub GPS_UserEnabled (Enabled As Boolean)
   'ToastMessageShow("GPS State " & Enabled ,True)
   Log("GPS State " & Enabled)
   If Enabled = False Then
      TGL.TurnGPSOn
   End If
   
End Sub
Sub Service_Destroy
   Log("Service ended.")
    
End Sub