Ph0tonic/SDP_Projet

View on GitHub
app/src/main/java/ch/epfl/sdp/MainApplication.kt

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
package ch.epfl.sdp

import android.app.Application
import android.content.Context
import androidx.preference.PreferenceManager
import com.mapbox.mapboxsdk.Mapbox

class MainApplication : Application() {

    init {
        instance = this
    }

    companion object {
        private var instance: MainApplication? = null

        fun applicationContext(): Context {
            return instance!!.applicationContext
        }
    }

    override fun onCreate() {
        super.onCreate()

        PreferenceManager.setDefaultValues(this, R.xml.root_preferences, false)

        // Mapbox access token is configured here. This needs to be called either in your application
        // object or in the same activity which contains the mapview.
        Mapbox.getInstance(this, getString(R.string.mapbox_access_token))
    }
}