I am developing an app which tracks the user location for every 10-20 secs. In order to make it work in the background and mobile locked stage, I had to make the following code edits:
In Android:
I added permission of "Wake_Lock" and added a line of code in MainActivity.cs like
this.Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);
In iOS (AppDelegate.cs):
UIApplication.SharedApplication.IdleTimerDisabled = true;
This makes the functionality good and it is tracking the location for every 10 secs even in background and mobile is locked which is good. But by adding this code the battery usage by the app is increased drastically.
Can anyone please help me if I am doing anything wrong and suggest me any idea to get the battery usage problem solved.