Capacitor Framework7 How to add OneSignal?

Hi everybody,
I’m actually working on our Mobile App (the Web app is on-line and working very well / GMAO app).

[ I already tested how to query and insert data… designing the app… no problem! I also implemented with success login/logout form and SC. ]

I need to add notifications to this mobile app (iOs+Android) and wanted to use OneSignal (or better/other solution). I’m a bit confused with the OneSignal docs and process I found… And that’s my really first time building this kind of mobile app, more precisely with Push notification.

Does anybody has got experience about doing this? Could someone share with us feedbacks, best practices, kind of “tutorial” or steps?

Many thanks in advance.
Sylvain

Hi,
I spend more time reading documentations and watching tuto about FCM that seems also a good solution. Anybody experienced setting FCM?
Many thanks

Actually, you need a bit of native code on both, Android and iOS, to support native Push Messages. Capacitor has a plugin for this (using FCM on Android).

Perhaps one of the Wappler guys can chime in how to integrate a “non Wappler” plugin? Could be straight forward.

1 Like

Thanks @HeikoK for your answer.
Already found this documentation - You confirmed what I understood :wink:
Well, I’m going forward with my tests…

I can confirm, it works in general :slight_smile:
Takes a bit to setup everything, especially on the iOS side…

Hi @HeikoK
Could you precise me the way you managed getting and saving “Player_ID/FCM_token” linked to the user_id on login?
Many thanks

Hi everybody,
I’m stuck with it.
This is the only “technical” part I can’t managed in my project.

I tried this morning to set FCM:

Following this tutorial: https://www.youtube.com/watch?v=YUr8pw0nO7Y

I created a new FCM project with iOS and Android apps
I downloaded and installed both google-services.json and GoogleService-info.plist
I modified my capacitor.config.json file adding:

plugins: {
PushNotifications: {
  presentationOptions: ["badge", "sound", "alert"],
}, },

I modified my ios/App/Podfile adding:

pod 'Firebase/Messaging'

I modified my AddDelegate.swift file: importing Firebase + adding functions about TOKEN (https://capacitorjs.com/docs/apis/push-notifications or https://capacitorjs.com/docs/guides/push-notifications-firebase)

My problem is I can’t install @capacitor/push-notifications package…

'Log files:
/Users/sylvainbaron/.npm/_logs/2023-05-10T14_45_01_214Z-debug-0.log
npm resolution error report
While resolving: wappler_mobile_app@1.0.0
Found: @capacitor/core@4.8.0
node_modules/@capacitor/core
@capacitor/core@"^4.8.0" from the root project
Could not resolve dependency:
peer @capacitor/core@"^5.0.0" from @capacitor/push-notifications@5.0.2
node_modules/@capacitor/push-notifications
@capacitor/push-notifications@"*" from the root project
Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

I tried to installed different capacitor version and --force capacitor push notification then my android buil failed.

FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':capacitor-push-notifications:compileDebugJavaWithJavac'.
    > error: invalid source release: 17

How to fix this?
Maybe i’m not doing the right way setting FCM?

Thanks for your help.
I really need to activate Push notification super quickly (my customer and partner are waiting for this new feature this week - i’m 100% dedicated on it these nights and days).

(I’m OK to use an other Push solution, i don’t care about the tool just need notifications)
If Wappler team can help me it’ld be awesome!!! (@George, @Teodor)

Many many many thanks!

Hi HeikoK,
Actually my app works perfectly on both iOS and Android with capacitor (and bootstrap finally) but I can’t Get the OneSignal PID on iOS to save it as a var in the app then use it fdisplayint it or saving it linked to the user.
have you got a trick for me?
Thanks