I want to monitor battery temperature, if available. I create a
Receiver like this:
private BroadcastReceiver myTempReceiver = new BroadcastReceiver()
{
@Override
public void onReceive(Context ctx, Intent myIntent ) {
int temp = myIntent.getIntExtra(
BatteryManager.EXTRA_TEMPERATURE ,
0 );
commonTempLogic( (float) temp );
}
And I register it like this:
registerReceiver(myTempReceiver, new
IntentFilter(Intent.ACTION_BATTERY_CHANGED));
When onReceive gets the first Intent, it fails with an exception:
07-07 22:10:01.186: ERROR/AndroidRuntime(777):
java.lang.RuntimeException: Error receiving broadcast Intent
{ act=android.intent.action.BATTERY_CHANGED flg=0x40000000 (has
extras) } in com.shipmate.sensorservic...@43d1b250
Any idea why this might be happening?
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en