humhub / fcm-push

Enables your users to receive push notifications from your network.
4 stars 5 forks source link

iOS Webview Device ID #4

Closed mechiles closed 1 year ago

mechiles commented 3 years ago

I've created an app using a Webview wrapper with Humhub. I have FCM enabled and it's working for web and Android push notifications, however, I don't see a good way to get the device ID from iOS to put into the fcmpush database. Any way of doing this? If I plug my iPhone in and run the build from Xcode to it, I can get the device ID, put it into the database and I do get the push notifications on my iPhone. Just need a way to extract that without the manual effort.

luke- commented 3 years ago

On Android the ID is added using a POST to http://example.com/fcm-push/token/update with POST data token. Did you tried this?

mechiles commented 3 years ago

Hey @luke- thanks for getting back to me. I'm not sure how it would be any different when logging into the app on iOS. The code is still set to update the token but doesn't get it with iOS. I think it has to do with it being a webview wrapper app and not passing the token back through. I'm not sure if there is a way to do this.

luke- commented 3 years ago

Unfortunately, I don't know much about it either. I only know that the token can be written into the database via the update action.

steffes commented 3 years ago

@mechiles check out this issue https://github.com/humhub/humhub-modules-fcm-push/issues/1 I got the device ID using Xamarin.Forms and the Xamarin.Firebase.iOS.CloudMessaging package. iOS WebViews alone are not going to get you access. If they did I could have avoided building a whole app just to get notifications.

mechiles commented 3 years ago

Thanks @steffes. I'm hoping to not have to build an entire app.... At least at the moment.

mechiles commented 3 years ago

@steffes would you be interested in sharing your app code or open-sourcing it, without any of your intellectual property in it?

samuk commented 3 years ago

I don't understand some of this thread. Is the upshot that push notifications cannot be made to work on iPhone?

mechiles commented 3 years ago

@samuk in essence, the push notifications cannot be used with a WebView wrapper app. @steffes built an app just to allow the notifications to work. I didn't necessarily want to have to create a full native app for it.

samuk commented 3 years ago

Thanks, that's annoying. Did you do the app in the end? Do you have any code you could share?

mechiles commented 3 years ago

Unfortunately, I wasn’t able to get anything to work. So, for now, I’ve focused sending emails for posts.

On Thu, Aug 26, 2021 at 10:21 AM samuk @.***> wrote:

Thanks, that's annoying. Did you do the app in the end? Do you have any code you could share?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/humhub-contrib/fcm-push/issues/4#issuecomment-906507852, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPWNLTUBW5GSGEGSMBIIHDT6ZLY5ANCNFSM4WM65L7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

JK742020 commented 2 years ago

@steffes did I understand right that you built an app to get notifications from humhub on iOS and android? How does it work from an end user's point of view? Is it available on github or for sale? I am a bit frustrated about humhub not having pushnotifications the users are used to from other mobile apps. Looking forward to hearing from you! Thanks. Jürgen

steffes commented 2 years ago

@JK742020 I was forced to build an iOS app in order to get push notifications. On Android, you can add HumHub to your homescreen as a PWA and can receive WebPush Notifications.

I built a Xamarin iOS app that required an unreasonable amount of steps to get to the default functionality of an Android PWA with WebPush Notifications. Unfortunately I can't release code at the moment @samuk @mechiles .

Here is a sample list of steps:

https://docs.microsoft.com/en-us/xamarin/ios/platform/user-notifications/advanced-user-notifications?tabs=macos Here is a Xamarin.iOS sample app for notifications https://docs.microsoft.com/en-us/samples/xamarin/ios-samples/ios10-monkeynotify/

JK742020 commented 2 years ago

thanks steffes!