Last active
August 29, 2015 14:06
-
-
Save vivekrk/251bd7e7403d489f0fb0 to your computer and use it in GitHub Desktop.
Hard coded expiry
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
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_home); | |
NotificationManager.getInstance().addObserver(loginSucess.name(), this); | |
if (isExpired()) { | |
AlertDialog alertDialog = new AlertDialog.Builder(this) | |
.setTitle("Expired") | |
.setCancelable(false) | |
.setMessage("This Build has expired!") | |
.setNeutralButton("Close", new DialogInterface.OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialogInterface, int i) { | |
finish(); | |
} | |
}).create(); | |
alertDialog.show(); | |
} | |
// loadUI(); | |
} | |
private boolean isExpired() { | |
Calendar expiryDate = Calendar.getInstance(); | |
expiryDate.set(Calendar.MONTH, Calendar.SEPTEMBER); | |
expiryDate.set(Calendar.DATE, 14); | |
expiryDate.set(Calendar.YEAR, 2014); | |
Calendar current = Calendar.getInstance(); | |
return current.getTime().after(expiryDate.getTime()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment