mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-09 23:41:08 +01:00
Add SCHEDULE_EXACT_ALARM permission
This commit is contained in:
parent
87fd45cfa1
commit
1a93cd3fd6
2 changed files with 7 additions and 6 deletions
|
@ -5,7 +5,10 @@
|
|||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
|
||||
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
|
||||
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
|
||||
|
||||
|
||||
<application
|
||||
android:fullBackupContent="true"
|
||||
|
|
|
@ -42,6 +42,7 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||
calendar.setTimeInMillis(nextSchedule.getTime());
|
||||
} else {
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 11);
|
||||
calendar.set(Calendar.MINUTE, 15);
|
||||
today = calendar.getTime();
|
||||
calendar.add(Calendar.DAY_OF_YEAR, 1);
|
||||
tomorrow = calendar.getTime();
|
||||
|
@ -60,12 +61,9 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,(calendar.getTimeInMillis()),
|
||||
AlarmManager.ELAPSED_REALTIME, alarmIntent);
|
||||
alarmManager.setExact(AlarmManager.RTC_WAKEUP, (calendar.getTimeInMillis()), alarmIntent);
|
||||
} else {
|
||||
|
||||
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, (calendar.getTimeInMillis()),
|
||||
AlarmManager.INTERVAL_DAY, alarmIntent);
|
||||
alarmManager.setExact(AlarmManager.RTC_WAKEUP, (calendar.getTimeInMillis()), alarmIntent);
|
||||
}
|
||||
|
||||
Log.d(TAG, "Alarm scheduled for " + UtilDate.convertDate(calendar.getTimeInMillis()));
|
||||
|
@ -149,8 +147,8 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||
}
|
||||
|
||||
private void createNotificationChannel(Context context) {
|
||||
|
||||
Log.d(TAG, "start create notification channel");
|
||||
|
||||
CharSequence name = context.getString(R.string.channel_name);
|
||||
String description = context.getString(R.string.channel_description);
|
||||
int importance = NotificationManager.IMPORTANCE_DEFAULT;
|
||||
|
|
Loading…
Reference in a new issue