Skip to content
Back

Push Notification targets error

  • 1
  • Self Hosted
  • Flutter
  • Messaging
frankenstein
14 Mar, 2024, 06:49

Im setting up notifications in appwrite for a user with two sessions on two separate devices. But unfortunately appwrite allows two sessions but not two push targets of the same account. as shown in the pics

TL;DR
Developers discussing push notification targets error and handling notifications in Flutter using Firebase. Facing issues with Firebase CLI, manual installation, and crashes during app launch. One developer solved the issue by deleting the notification handler for Appwrite. Detailed steps provided for setting up Firebase SDK for notifications. Errors related to Appwrite NotificationHandler class discussed. Resolved issue of duplicate push targets by ensuring unique target IDs. Appwrite limitation of not allowing two push targets for the same account highlighted.
frankenstein
14 Mar, 2024, 08:32

Lemme try to print identifiers and compare. Because on is ios and other is android.

Steven
14 Mar, 2024, 08:39

Maybe it was added for another user already

frankenstein
14 Mar, 2024, 08:44

i compared users proviers and they are different. I have signed out every device and logged in when target id is 'unique()' and it worked.

frankenstein
14 Mar, 2024, 11:22

May be the issue was the login functions which creates a session then creates a target. So when i get an error the target isnt created and login session is created and when i trigger login again. appwrite detects there is a session already

Steven
14 Mar, 2024, 11:27

Login doesn't create a push target ๐Ÿง

frankenstein
14 Mar, 2024, 11:30

no. my function was that i create a session then i create a push. so i was getting an error on push target when a session is already created

frankenstein
14 Mar, 2024, 12:11

Hello @Steven my app crashes when i receive an fcm notification. it is related to notification handler

frankenstein
14 Mar, 2024, 12:11

E/AndroidRuntime(30943): java.lang.RuntimeException: Unable to create service io.appwrite.NotificationHandler: java.lang.ClassNotFoundException: Didn't find class "io.appwrite.NotificationHandler" on path: DexPathList[[zip file "/data/app/~~uGfbWv0P559iM7huRGUZNw==/com.pregnut.app-pFhFvbvxv7abzCwaZanCcw==/base.apk"],nativeLibraryDirectories=[/data/app/~~uGfbWv0P559iM7huRGUZNw==/com.pregnut.app-pFhFvbvxv7abzCwaZanCcw==/lib/arm64, /data/app/~~uGfbWv0P559iM7huRGUZNw==/com.pregnut.app-pFhFvbvxv7abzCwaZanCcw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64]]

Steven
14 Mar, 2024, 12:15

Hmm I'm not sure. Maybe you need some more setup

frankenstein
16 Mar, 2024, 08:09

This a serious issue. i dont even know where to start research about appwrite handler.

frankenstein
16 Mar, 2024, 08:09

Maybe anyone who has managed to setup notifications might help

frankenstein
16 Mar, 2024, 08:13
TypeScript

In your Firebase console, navigate to Settings > General > Your apps > add an Android app.

Register and download your google-services.json config file.

Add google-services.json at the root of your project.

Add Google Services class path to your app-level Gradle dependencies block "com.google.gms:google-services:4.4.0".

Add Google Services plugin to your app-level Gradle in the plugins block as "com.google.gms.google-services".

Add notification handler service to AndroidManifest.xml inside the application tag, alongisde other activities.```
frankenstein
16 Mar, 2024, 08:14

these steps are too summarised for a new feature

frankenstein
16 Mar, 2024, 13:09

i had to delete the notification handler for appwrite the notifications worked

frankenstein
16 Mar, 2024, 13:10

So i treat them as fcm notifications

Shiba
16 Mar, 2024, 14:04

facing the same issue here , sometimes it crashes even in debug mode on app launch

Shiba
16 Mar, 2024, 14:05

"com.google.gms:google-services:4.4.0". by adding this the app does not even compile for me

frankenstein
16 Mar, 2024, 14:08

My project is already using new buil.gradle format so manual installation of firebase was an issue

frankenstein
16 Mar, 2024, 14:08

I used firebase cli

Shiba
16 Mar, 2024, 14:09

flutterfire ?

frankenstein
16 Mar, 2024, 14:09

Yes, if you are using latest flutter version

frankenstein
16 Mar, 2024, 14:10

Then handle notifications like it's fcm

Steven
16 Mar, 2024, 15:42

Let me double check with the team on this

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more