Private function for toast

- Posted in Uncategorized by

Created a private function so I don't need to write very long and verbose syntax just to show a Toast. private fun oToast(text: String) {...

Check if Google Play Services is available

- Posted in Uncategorized by

Check if Google Play Services is available.

private fun checkPlayServices(): Boolean {
    val apiAvailability = GoogleApiAvailability.getInstance()
    val resultCode = apiAvailability.isGooglePlayServicesAvailable(this)

    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
              // Do stuff if Google Play is not available 
        } else {
              // Do stuff if Google Play is available 
            finish()
        }
        return false
    }
    return true
}

Change title of Main Activity

- Posted in Uncategorized by

Change the title that appears on the "title bar" of the main activity. By default, the main activity fragment displays the app name. Place this code inside the onCreate block....