I am writing an application that registers battery status, but there is a problem with BatteryManager.BATTERY_PLUGGED_WIRELESS . If I download my Galaxy S3 with Android 4.0.4 or even S4 from 4.2.2 to a wireless charging station, the application will display 1 ( BATTERY_PLUGGED_AC ) instead of 4 ( BATTERY_PLUGGED_WIRELESS ). A pop-up window will appear on the phoneβs display, indicating wireless charging. So is this an api error?
Can anyone confirm this? Is there any other way around the charging mode?
public class BatteryReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0); Toast.makeText(context, errorMsg, Toast.LENGTH_SHORT).show(); } }
source share