Created
March 30, 2020 16:22
-
-
Save eristoddle/a9ac29a473af92e7466c241616ab56cc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package com.eristoddle.boilerplate | |
import android.content.Context | |
import android.content.Intent | |
import android.os.Bundle | |
import androidx.appcompat.app.AppCompatActivity | |
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
checkEula() | |
} | |
private fun checkEula() { | |
val preferences = applicationContext | |
.getSharedPreferences("com.eristoddle.boilerplate", Context.MODE_PRIVATE) | |
val eulaAccepted = preferences.getBoolean("eulaAccepted", false) | |
if (!eulaAccepted) { | |
val intent = Intent(this, EulaActivity::class.java) | |
val bundle = Bundle() | |
val eula = R.raw.eula | |
bundle.putInt("eula", eula) | |
intent.putExtras(bundle) | |
startActivityForResult(intent, 1) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment