-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/ExactAlarmChagedReceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* [TRIfA], Java part of Tox Reference Implementation for Android | ||
* Copyright (C) 2017 - 2020 Zoff <[email protected]> | ||
* <p> | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* version 2 as published by the Free Software Foundation. | ||
* <p> | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* <p> | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the | ||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
package com.zoffcc.applications.trifa; | ||
|
||
import android.app.AlarmManager; | ||
import android.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.content.SharedPreferences; | ||
import android.os.Build; | ||
import android.preference.PreferenceManager; | ||
import android.util.Log; | ||
|
||
import static android.content.Context.ALARM_SERVICE; | ||
|
||
public class ExactAlarmChagedReceiver extends BroadcastReceiver | ||
{ | ||
private static final String TAG = "trifa.ExAlrmRecvr"; | ||
|
||
@Override | ||
public void onReceive(Context context, Intent intent) | ||
{ | ||
Log.i(TAG, "-- ON_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGE -- :000:" + intent.getAction()); | ||
if (intent.getAction().equals("android.intent.action.ACTION_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED")) | ||
{ | ||
Log.i(TAG, "-- ON_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGE -- :" + intent.getAction()); | ||
try | ||
{ | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) | ||
{ | ||
Log.i(TAG, "-- ON_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGE -- :001"); | ||
AlarmManager alarmManager = (AlarmManager)context.getSystemService(ALARM_SERVICE); | ||
if (alarmManager.canScheduleExactAlarms()) | ||
{ | ||
Log.i(TAG, "canScheduleExactAlarms:true"); | ||
} | ||
else | ||
{ | ||
Log.i(TAG, "canScheduleExactAlarms:**FALSE**"); | ||
} | ||
} | ||
Log.i(TAG, "-- ON_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGE -- :099"); | ||
} | ||
catch (Exception e) | ||
{ | ||
Log.i(TAG, "-- ON_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGE -- :EE01:" + e.getMessage()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters