https://stackoverflow.com/a/47020822/12620073 I tried to use this solution in my code in order to check whether the phone is being charged or not. However in this line -
BatteryManager myBatteryManager = (BatteryManager) context.getSystemService(Context.BATTERY_SERVICE);
I don't understand what should be the class of the term "context" nor what it is exactly. I'll really appreciate it if anyone will explain this to me.