Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read from both sources #88

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,31 +152,40 @@ protected Boolean doInBackground(Integer... params) {
boolean success = new Rest(mContext).getBg(requestCount);
Thread.sleep(10000);
if (success) {
//quick fix: stay awake a bit to handover wakelog
// stay awake a bit to handover wakelog
PowerManager powerManager = (PowerManager) getApplicationContext().getSystemService(POWER_SERVICE);
powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
"quickFix2").acquire(TIMEOUT);
powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "quickFix2").acquire(TIMEOUT);
mContext.startService(new Intent(mContext, WatchUpdaterService.class));
}
getApplicationContext().startService(new Intent(getApplicationContext(), Notifications.class));
if(mWakeLock != null && mWakeLock.isHeld()) { mWakeLock.release(); }
return true;
if (success)
{
return true;
}
}
}
catch (RetrofitError e) { Log.d("Retrofit Error: ", "BOOOO"); }
catch (InterruptedException exx) { Log.d("Interruption Error: ", "BOOOO"); }
catch (Exception ex) { Log.d("Unrecognized Error: ", "BOOOO"); }
try {
if(mPrefs.getBoolean("share_poll", false)) {
Log.d("ShareRest", "fetching " + requestCount);
boolean success = new ShareRest(mContext).getBg(requestCount);
Thread.sleep(10000);
if (success) {
//test wakelock: stay awake a bit to handover wakelog
// stay awake a bit to handover wakelog
PowerManager powerManager = (PowerManager) getApplicationContext().getSystemService(POWER_SERVICE);
powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
"quickFix3").acquire(TIMEOUT);
powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "quickFix3").acquire(TIMEOUT);

mContext.startService(new Intent(mContext, WatchUpdaterService.class));
}
getApplicationContext().startService(new Intent(getApplicationContext(), Notifications.class));
if(mWakeLock != null && mWakeLock.isHeld()) { mWakeLock.release(); }
return true;
if (success)
{
return true;
}
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private void FileBasedNotifications(Context context) {
// If the last reading does not have a sensor, or that sensor was stopped.
// or the sensor was started, but the 2 hours did not still pass? or there is no calibrations.
// In all this cases, bgReading.sgv_double() should be 0.
if (bgReading != null && bgReading.sgv_double() != 0) {
if (bgReading != null && bgReading.sgv_double() != 0 && bgReading.timeSince() < 14400) {
AlertType newAlert = AlertType.get_highest_active_alert(context, bgReading.sgv_double());

if (newAlert == null) {
Expand Down