Failing to implement firebase to android app

Ronald 3 years ago

Good day

I am failing to implement firebase to Traccar Manager (Android).
After adding google-services.json and building the app in Android Studio, i can see Notification Tokens being generated under the account attributes, however if i trigger a test notification (Firebase only) i am getting the following error

Cannot invoke "String.getBytes()" because the return value of "org.traccar.config.Config.getString(org.traccar.config.ConfigKey)" is null - NullPointerException (NotificatorFirebase:57 < <gener:-1 < *:-1 < ... < NotificatorManager:73 < ...)

I am assuming i'm using the wrong firebase key as i am attempting to use API V1 but i am not 100% sure.

I have tried to use the Legacy server key and getting the same effect.

I'd kindly appreciate any pointers as to what i may have done wrong.

Thanks

Anton Tananaev 3 years ago

You have to provide service account in the config (see notificator.firebase.serviceAccount parameter).

Ronald 3 years ago

Thank you Anton. It worked.

gmartinez 3 years ago

Hi every one! Where I can see the notificatior.firebase.service Account? How I can provide service account? I am lost.. thanks for your support.

gmartinez 3 years ago

Hi every one! Sorry for the last post, I have Two questions..

  1. Where I can see the notificatior.firebase.serviceAccount?
  2. How I can provide service account?

I am lost.. I see a notificatior.firebase.serviceAccount in root: src>main>java>org>traccar>config>keys.java but Wath i need to do? copy and pase all .json firebasefile in firebase section inside of keys.java?

Thanks for your support.

Anton Tananaev 3 years ago

Please don't duplicate your questions.

gmartinez 3 years ago

Sorry, I was lost. Thanks Anton.

gmlmaino 3 years ago

is this new only, or also the old token?