mapbox / mapbox-navigation-android-examples

Other
53 stars 46 forks source link

highlight the need for a secret token #68

Closed LukasPaczos closed 2 years ago

LukasPaczos commented 2 years ago

Closes https://github.com/mapbox/mapbox-navigation-android-examples/issues/64.

VysotskiVadim commented 2 years ago

@LukasPaczos , I'm not sure that people read README.md before launching examples for the first time. Also the failure caused by a lack of the access token isn't obvious. Last time I forgot to fill up the access token I got an empty map. It wasn't obvious what is going on 🙂 What if we put additional check in the MainActivity:

fun onCreate(bundle: savedInstanceState: Bundle?) {
    if (getString(R.string.mapbox_access_token) == ACCESS_TOKEN_PLACE_HOLDER) {
        val builder = AlertDialog.Builder(this)
        builder.setTitle("Error: token isn't initialised")
        builder.setMessage("Please put your mapbox token in res/values/mapbox_access_token.xml")
        builder.setPositiveButton("Ok") { dialog, which ->
            finish()
        }
        return
    }
    ...
}

What do you think?

LukasPaczos commented 2 years ago

Sounds good to me, we can add a similar check to build.gradle and throw a clear exception when the downloads token is not set.

Wanna run with that or cut a ticket?

VysotskiVadim commented 2 years ago

@LukasPaczos , it's faster to implement than cut a ticket https://github.com/mapbox/mapbox-navigation-android-examples/pull/70