parker parker - 4 months ago 229
Android Question

Why FirebaseApp initialization is very slow,How to reduce app start time

I am making one android app,earlier i have used gcm for push notification,right now I am trying firebase cloud messaging for sending push notifications.I have implemented firebase cloud messaging functionality in my app it is working fine but problem is it is taking too much time when app launches first time,please help me

build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.next.fcm"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}

}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'

compile 'com.google.firebase:firebase-messaging:9.0.0'

}
apply plugin: 'com.google.gms.google-services'

Answer

Do not compile whole fcm lib just compile below line.

compile "com.google.firebase:firebase-messaging:9.0.0"