Skip to content
Snippets Groups Projects
Commit dadcd5cd authored by Volker Richert's avatar Volker Richert
Browse files

code cleanup

parent 9d3e5180
No related branches found
No related tags found
No related merge requests found
......@@ -123,8 +123,8 @@ public class MainActivity extends AppCompatActivity implements OnSharedPreferenc
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
final String packageName = getPackageName();
//Log.d(TAG, "Maybe ignoring battery optimization");
final PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
if (!pm.isIgnoringBatteryOptimizations(packageName)) {
Log.d(TAG, "Requesting ignore battery optimization");
try {
......
......@@ -66,9 +66,12 @@ public class MedtronicCnlAlarmReceiver extends WakefulBroadcastReceiver {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
alarmManager.setAlarmClock(new AlarmManager.AlarmClockInfo(millis, null), pendingIntent);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// Android 5.0.0 + 5.0.1 (e.g. Galaxy S4) has a bug.
// Alarms are not exact. Fixed in 5.0.2 oder CM12
alarmManager.setExact(AlarmManager.RTC_WAKEUP, millis, pendingIntent);
} else
} else {
alarmManager.set(AlarmManager.RTC_WAKEUP, millis, pendingIntent);
}
}
// restarting the alarm after MedtronicCnlIntentService.POLL_PERIOD_MS from now
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment