Back to project page CallerFlashlight.
The source code is released under:
GNU General Public License
If you think the Android project CallerFlashlight listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.spirosbond.callerflashlight; /*from w w w .ja v a2 s . c om*/ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; /** * Created by spiros on 11/7/13. */ public class BatteryLevelReceiver extends BroadcastReceiver { private static final String TAG = BatteryLevelReceiver.class.getSimpleName(); @Override public void onReceive(Context context, Intent intent) { CallerFlashlight callerFlashlight = (CallerFlashlight) context.getApplicationContext(); // String level = BatteryManager.EXTRA_LEVEL; // if (CallerFlashlight.LOG) Toast.makeText(context, intent.getAction(), Toast.LENGTH_LONG).show(); if (CallerFlashlight.LOG) Log.d(TAG, "intent action: " + intent.getAction()); // if (CallerFlashlight.LOG) Log.d(TAG, "battery level:" + level); if (intent.getAction().equals(Intent.ACTION_BATTERY_LOW)) callerFlashlight.setLowBat(true); else callerFlashlight.setLowBat(false); } }