I have this application that receive push notifications,
first in my Application class i enabled disk Persistence like this :
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
then i receive push notification and open the application by clicking on it, here is the method that get invoked :
private void startIntent(final String msgID) {
    mRefMessages = fbdb.getReference(AppConstants.TableMessages.Table_name);
    mRefMessages.keepSynced(true);
    mQueryMessg = mRefMessages.child(msgID).orderByValue() ;
    Log.d(TAG  ,"ref=>\n" + mQueryMessg.getRef().toString() ) ;
    mQueryMessg.addListenerForSingleValueEvent(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            Log.d(TAG, "data snap Shot = " + dataSnapshot.getValue());
            if (dataSnapshot.hasChild(AppConstants.Key_Type))
            {
                Toast.makeText(ActivityMessages.this, "have child type == true" , Toast.LENGTH_SHORT).show();
                //open message view
                //some code . . .
            }
        }
        @Override
        public void onCancelled(DatabaseError databaseError) {
            Log.d(TAG, "data base eror " + databaseError.toString());
        }
    });
}
- the msgID is received in the intent extras,
 - the first time i open the application from the push notification, i print the data snap shot and the value exists and the other times the data snapshot has value dos not exists (data snap Shot = null ) !!
 - note that the data is exist in the fire base and the msgID is Correct , and the fire base reference is correct too.
 
if i go back and disable the Disk Persistence i dont have this behavior and the data snapshot value is found !
why this is happening ? what im missing ?
build.gradle snippet
dependencies {
    classpath 'com.android.tools.build:gradle:2.3.2'
    classpath 'com.google.gms:google-services:3.1.0'
    classpath 'com.google.firebase:firebase-plugins:1.1.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
and I am using 11.0.2 version of firebase sdk
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
    applicationId "co.newandroiddummy"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
    compile 'com.google.firebase:firebase-database:11.0.2'