Skip to content

Instantly share code, notes, and snippets.

@eristoddle
Created March 30, 2020 16:34
Show Gist options
  • Save eristoddle/39f324095bc8f4379cdc70c46781c1b4 to your computer and use it in GitHub Desktop.
Save eristoddle/39f324095bc8f4379cdc70c46781c1b4 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