android - Unable to get DatabaseReference and FIrebaseAuth currentUser on a remote(separate from main thread) process -
i want create separate process receive , update firebase database using separate process keep running application(main thread) stopped or killed. returns me exception below.
error
09-22 22:39:02.229 1669-1669/com.tradesomev4.tradesomev4:remote e/androidruntime: fatal exception: main process: com.tradesomev4.tradesomev4:remote, pid: 1669 java.lang.runtimeexception: unable create service com.tradesomev4.tradesomev4.m_helpers.locationservice: java.lang.illegalstateexception: firebaseapp name [default] doesn't exist. @ android.app.activitythread.handlecreateservice(activitythread.java:3005) @ android.app.activitythread.access$1800(activitythread.java:178) @ android.app.activitythread$h.handlemessage(activitythread.java:1553) @ android.os.handler.dispatchmessage(handler.java:111) @ android.os.looper.loop(looper.java:194) @ android.app.activitythread.main(activitythread.java:5637) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:959) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:754) caused by: java.lang.illegalstateexception: firebaseapp name [default] doesn't exist. @ com.google.firebase.firebaseapp.getinstance(unknown source) @ com.google.firebase.firebaseapp.getinstance(unknown source) @ com.google.firebase.database.firebasedatabase.getinstance(unknown source) @ com.tradesomev4.tradesomev4.m_helpers.locationservice.oncreate(locationservice.java:128) @ android.app.activitythread.handlecreateservice(activitythread.java:2995) @ android.app.activitythread.access$1800(activitythread.java:178) @ android.app.activitythread$h.handlemessage(activitythread.java:1553) @ android.os.handler.dispatchmessage(handler.java:111) @ android.os.looper.loop(looper.java:194) @ android.app.activitythread.main(activitythread.java:5637) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:959) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:754)
manifest
<service android:name=".m_helpers.locationservice" android:enabled="true" android:exported="true" android:process=":remote"> </service>
service java
@override public int onstartcommand(intent intent, int flags, int startid) { log.e(debug_tag, "onstartcommand"); super.onstartcommand(intent, flags, startid); return start_sticky; } @override public void oncreate() { log.e(debug_tag, "oncreate"); databasereference = firebasedatabase.getinstance().getreference("https://project-7989634332026765831.firebaseio.com/"); firebaseuser = firebaseauth.getinstance().getcurrentuser(); }
hoping kind response :)
Comments
Post a Comment