battery – Charging control in Android without using any third-party apps

Is there any way to control charging in Android programatically without using any third party Apps?

We have an Android Application which has to be installed at Client Location in Tab and the tab has to be charged and running continuously without getting tab turn off which leads to battery health drop. So We have to implement a solution in our app where the user can set some limit to charging to control even if the charger is connected physically.

(Example: If i set some 80% as higher limit and 20% as lower limit then the tab should get stop charging when it reaches to 80% and start charging when it reaches to 20% automatically).

I had been searching lot of resources and didn’t found any solution to this problem.

There are few applications available on the Play store for this like “Battery Charge Limit” but I don’t want to use any others apps to do this. I want it to include this feature in our app.

Can someone please tell me Is there any way to do this.

Thanks in advance.