diff --git a/app/build.gradle b/app/build.gradle index cc78475..c9e7526 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "org.literacyapp.startguide" minSdkVersion 21 targetSdkVersion 23 - versionCode 1000001 - versionName "1.0.1" + versionCode 1000002 + versionName "1.0.2" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/src/main/java/org/literacyapp/startguide/receiver/BootReceiver.java b/app/src/main/java/org/literacyapp/startguide/receiver/BootReceiver.java index 8fc5704..495be65 100644 --- a/app/src/main/java/org/literacyapp/startguide/receiver/BootReceiver.java +++ b/app/src/main/java/org/literacyapp/startguide/receiver/BootReceiver.java @@ -12,7 +12,7 @@ public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()) && StartPrefsHelper.startAfterBoot(context)) { + if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()) && !StartPrefsHelper.inactivateStartGuide()) { Intent bootIntent = new Intent(context, SwipeUpDownActivity.class); bootIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(bootIntent); diff --git a/app/src/main/java/org/literacyapp/startguide/util/StartPrefsHelper.java b/app/src/main/java/org/literacyapp/startguide/util/StartPrefsHelper.java index e746281..e4f47aa 100644 --- a/app/src/main/java/org/literacyapp/startguide/util/StartPrefsHelper.java +++ b/app/src/main/java/org/literacyapp/startguide/util/StartPrefsHelper.java @@ -5,6 +5,8 @@ import android.preference.PreferenceManager; import android.util.Log; +import java.util.Date; + public class StartPrefsHelper { @@ -26,6 +28,15 @@ public static boolean startAfterBoot(Context context) { return ((firstStartupDate + SEVEN_DAYS_IN_MILLISECONDS) > currentDate); } + public static boolean inactivateStartGuide(){ + //UTC Thu May 11 2017 20:59:59 + long inactivationTime = 1494536399000L; + long currentTime = System.currentTimeMillis(); + boolean inactive = currentTime > inactivationTime; + Log.i(StartPrefsHelper.class.getName(), "Start Guide inactive: " + inactive + ", inactivationTime: " + new Date(inactivationTime) + ", currentTime: " + new Date(currentTime)); + return inactive; + } + private static long getFirstStartupDate(Context context) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); return sharedPreferences.getLong(PREF_FIRST_STARTUP_DATE, 0);