Doubts with android push notifications. I ask for help

Manuel Suárez10 months ago

I am trying to compile my custom traccar manager apps, for now on android, in my traccar.xml config add this:

<entry key='notificator.types'>web,mail,firebase</entry>
<entry key='notificator.firebase.serviceAccount'>
  {
  "type": "......",
  "project_id": "......",
  "private_key_id": "......",
  "private_key": "-----BEGIN PRIVATE KEY-----......\n-----END PRIVATE KEY-----\n",
  "client_email": "......",
  "client_id": "......",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "......"
  }
</entry>

And in my android app in project/app/ add my google-services.json file, also in build.gradle file change applicationId 'my.app'.

When I sent a test message in the traccar logs, it does not show me any errors or output messages (Notifications by email and telegram work perfectly for me and do not show output messages either), but the notifications do not reach the Android device, it is possible Clarify that I haven't modified anything in the traccar manager app yet, I just added the .json from firebase and I'm using traccar 5.8 and the latest traccarmanager code, it was downloaded today, I don't know if I'm omitting something in the process.

I should also mention that the token is not being saved as an attribute in Traccar, the issue is that I can't find any error that shows me either traccar or android studio

Anton Tananaev10 months ago
  1. What flavor of the app are you compiling?
  2. Have you checked user attributes to see if you get the notification token on login there?
Manuel Suárez10 months ago

What flavor of the app are you compiling?

Traccar Manager code version is version 36

defaultConfig { applicationId 'location.gps' minSdkVersion 19 targetSdkVersion 33 versionCode 36 versionName '4.0' multiDexEnabled true }

Have you checked user attributes to see if you get the notification token on login there?

Yes, it receives the user's attributes and the token is not generated.

Anton Tananaev10 months ago

Unfortunately you haven't answered the first question. To enable push notifications you have to build the Google flavor of the app.

Manuel Suárez10 months ago

I did not understand the question correctly I am emulating traccar manager it has not yet been compiled, I think from the question it is not possible to generate the tocken if the app is in an android studio emulator, what would be the correct flavor to compile the google app?

Anton Tananaev10 months ago

The flavor you have to build is called "google". I feel like you don't know what a flavor is. I would recommend researching it. It's a standard term in Android development.