Как передать объект android.hardware.camera2.TotalCaptureResult в JobIntentService

Вы получаете исключение Firebase Context.

java.lang.RuntimeException: You need to set the Android context using Firebase.setAndroidContext() before using Firebase

В зависимости от того, какую версию вы используете, вам необходимо передать контекст приложения в Firebase, как это

public class MyApplication extends android.app.Application {

    @Override
    public void onCreate() {
        super.onCreate();

        //Previous versions of Firebase
        Firebase.setAndroidContext(this);

        //Newer version of Firebase
        if(!FirebaseApp.getApps(this).isEmpty()) {
            FirebaseDatabase.getInstance().setPersistenceEnabled(true);
        }
    }
}

Обновите свой манифест с помощью

<application 
        android:label="@string/app_name"
        android:name=".MyApplication">
...
</application>
0
задан code_sniper 19 January 2019 в 21:53
поделиться