:sign0085:
Hallo,
I have a Problem with the Phone Event "BatteryChanged"
If the widget is the first time I pull on the Home Screen its works, the second time to add the Widget the code crashes.
Why?
here is the Code
ub Process_Globals
Dim rv As RemoteViews
Dim ph As PhoneEvents
End Sub
Sub Service_Create
ph.Initialize("ev")
rv = ConfigureHomeWidget("Akkuw.bal", "rv", 0, "Akku1")
End Sub
Sub Service_Start (StartingIntent As Intent)
If rv.HandleWidgetEvents(StartingIntent) Then Return
End Sub
Sub rv_RequestUpdate
rv.UpdateWidget
End Sub
Sub rv_Disabled
ph.StopListening
StopService("")
End Sub
Sub Service_Destroy
End Sub
Sub ev_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
Log(level)
Log(Scale)
Log(Plugged)
'rv.SetProgress("ProgressBar1",level)
'rv.SetText("label1",level)
'rv.UpdateWidget
End Sub
Regards
PS:
Error Message in the Log
java.lang.IllegalArgumentException: Receiver not registered: anywheresoftware.b4a.phone.PhoneEvents$16@48270c68
Testet on HTC Desire & Samsung Galaxy TAB
Hallo,
I have a Problem with the Phone Event "BatteryChanged"
If the widget is the first time I pull on the Home Screen its works, the second time to add the Widget the code crashes.
Why?
here is the Code
ub Process_Globals
Dim rv As RemoteViews
Dim ph As PhoneEvents
End Sub
Sub Service_Create
ph.Initialize("ev")
rv = ConfigureHomeWidget("Akkuw.bal", "rv", 0, "Akku1")
End Sub
Sub Service_Start (StartingIntent As Intent)
If rv.HandleWidgetEvents(StartingIntent) Then Return
End Sub
Sub rv_RequestUpdate
rv.UpdateWidget
End Sub
Sub rv_Disabled
ph.StopListening
StopService("")
End Sub
Sub Service_Destroy
End Sub
Sub ev_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
Log(level)
Log(Scale)
Log(Plugged)
'rv.SetProgress("ProgressBar1",level)
'rv.SetText("label1",level)
'rv.UpdateWidget
End Sub
Regards
PS:
Error Message in the Log
java.lang.IllegalArgumentException: Receiver not registered: anywheresoftware.b4a.phone.PhoneEvents$16@48270c68
Testet on HTC Desire & Samsung Galaxy TAB
Last edited: