using Android.Content;
using Android.OS;
using GMCabsDriverAssistant.Services;
using GMCabsDriverAssistantSolution.Platforms.Android.Services;
using Microsoft.Maui.Controls.Compatibility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

[assembly: Dependency(typeof(BatteryImplementationService))]
namespace GMCabsDriverAssistantSolution.Platforms.Android.Services
{
    public class BatteryImplementationService : IBatteryInfo
    {
        public bool CheckIsIgnoringBatteryOptimizations()
        {

            PowerManager pm = (PowerManager)global::Android.App.Application.Context.GetSystemService(Context.PowerService);
            //enter you package name of your application
            bool result = pm.IsIgnoringBatteryOptimizations("au.com.gmcabs.driverassistant");
            return result;
        }

        [System.Obsolete]
        public void StartSetting()
        {
            Intent intent = new Intent();

            intent.SetAction(global::Android.Provider.Settings.ActionIgnoreBatteryOptimizationSettings);
            global::Android.App.Application.Context.StartActivity(intent);
            // StartActivity(intent);
        }
    }
}
