Last active
October 7, 2021 02:07
-
-
Save maxirosson/ea70f401f5c93a4c1c06c0c935194136 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dipien.startup | |
import android.content.ContentProvider | |
import android.content.ContentValues | |
import android.database.Cursor | |
import android.net.Uri | |
import android.os.Handler | |
import android.os.Looper | |
import android.util.Log | |
class StartupTimeProvider: ContentProvider() { | |
companion object { | |
private val TAG = StartupTimeProvider::class.simpleName | |
} | |
private val mainHandler = Handler(Looper.getMainLooper()) | |
override fun onCreate(): Boolean { | |
try { | |
if (FirebaseApp.initializeApp(context!!) == null) { | |
Log.w(TAG, "FirebaseApp initialization unsuccessful"); | |
} else { | |
Log.i(TAG, "FirebaseApp initialization successful"); | |
} | |
StartupTrace.onColdStartInitiated(context!!) | |
mainHandler.post(StartupTrace.StartFromBackgroundRunnable) | |
} catch (e: Exception) { | |
Log.e(TAG,"Failed to initialize StartupTimeProvider", e) | |
} | |
return true | |
} | |
override fun query(uri: Uri, projection: Array<out String>?, selection: String?, selectionArgs: Array<out String>?, sortOrder: String?): Cursor? { | |
return null | |
} | |
override fun getType(uri: Uri): String? { | |
return null | |
} | |
override fun insert(uri: Uri, values: ContentValues?): Uri? { | |
return null | |
} | |
override fun delete(uri: Uri, selection: String?, selectionArgs: Array<out String>?): Int { | |
return 0 | |
} | |
override fun update(uri: Uri, values: ContentValues?, selection: String?, selectionArgs: Array<out String>?): Int { | |
return 0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment