I am not gonna tell you that I know how to do it or where to begin. Currently I am working on a small project in my company and I need to create an license agreement pop with two options. If you disagree with rules then app will be closed if you agree with rules, app will be opened.
Update:
Created a pop up that will be active on first run, agree and cancel options work. But when I click outside the pop up box it will be closed and I can use my app that shouldn't be the case
public void checkFirstRun() {
boolean isFirstRun = getSharedPreferences("PREFERENCE", MODE_PRIVATE).getBoolean("isFirstRun", true);
if (isFirstRun){
new AlertDialog.Builder(this)
.setTitle("Agreement")
.setMessage("Text")
.setPositiveButton("Agree",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
getSharedPreferences("PREFERENCE", MODE_PRIVATE)
.edit()
.putBoolean("isFirstRun", false)
.apply();
}
})
.setNegativeButton("Cencel",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
finish();
}
})
.show();
}
}