Skip to content

Instantly share code, notes, and snippets.

@eristoddle
Created March 30, 2020 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eristoddle/a9ac29a473af92e7466c241616ab56cc to your computer and use it in GitHub Desktop.
Save eristoddle/a9ac29a473af92e7466c241616ab56cc to your computer and use it in GitHub Desktop.
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