0
public class MyReceiver extends BroadcastReceiver {

    public void onReceive(Context context, Intent intent) {
        try {

            IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
            Intent batteryStatus = context.registerReceiver(null, ifilter);

            int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
            boolean isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING ||
                status == BatteryManager.BATTERY_STATUS_FULL;

            if (isCharging == true) {
                Toast.makeText(context, "PLEASE UNPLUG", Toast.LENGTH_LONG).show();

            }
        }
        catch(Exception e)
        {
            System.out.print("e");
        }
    }
}

I have implemented code for checking the charging status..... I want to know how to disable touch interface in broadcastreceiver when the device is charging??

tritop
  • 1,655
  • 2
  • 18
  • 30
vickychala
  • 11
  • 4

0 Answers0