Java tutorial
//package com.java2s; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; public class Main { private static Intent getChargingIntent(Context paramContext) { if (paramContext == null) { return null; } return paramContext.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED")); } }