48 lines
1.4 KiB
Kotlin
48 lines
1.4 KiB
Kotlin
package net.adphi.apps.parseapplication
|
|
|
|
import android.app.Application
|
|
import com.danylovolokh.androidlogger.AndroidLogger
|
|
import com.parse.Parse
|
|
import com.parse.ParseLiveQueryClient
|
|
import net.adphi.apps.parseapplication.Utils.LOG
|
|
import net.adphi.apps.parseapplication.Utils.getTAG
|
|
import net.adphi.apps.parseapplication.Utils.registerParseObject
|
|
import java.io.IOException
|
|
import java.net.URI
|
|
|
|
|
|
/**
|
|
* Created by Philippe-Adrien on 25/03/2018.
|
|
*/
|
|
|
|
@Suppress("UNUSED")
|
|
class ParseApplication : Application() {
|
|
|
|
private val TAG: String = getTAG(this)
|
|
|
|
override fun onCreate() {
|
|
super.onCreate()
|
|
|
|
val logsDirectory = AndroidLogger.getDefaultLogFilesDirectory(this)
|
|
val logFileMaxSizeBytes = 2 * 1024 * 1024 // 2Mb
|
|
try {
|
|
AndroidLogger.initialize(
|
|
this,
|
|
logsDirectory,
|
|
"ParseApplicationLog",
|
|
logFileMaxSizeBytes,
|
|
false
|
|
)
|
|
} catch (e: IOException) {
|
|
LOG.err(TAG, "Could not create Log File. Error: ${e.message}")
|
|
}
|
|
|
|
|
|
registerParseObject()
|
|
val config: Parse.Configuration = Parse.Configuration.Builder(this)
|
|
.maxRetries(1).build()
|
|
Parse.initialize(config)
|
|
val liveQueryClient = ParseLiveQueryClient.Factory.getClient(URI("wss://parsetest.back4app.io"))
|
|
LOG.inf(TAG, "Current Version Code: ${BuildConfig.VERSION_CODE}")
|
|
}
|
|
} |