Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Webview Device ID #4

Closed
mechiles opened this issue Jan 21, 2021 · 13 comments
Closed

iOS Webview Device ID #4

mechiles opened this issue Jan 21, 2021 · 13 comments

Comments

@mechiles
Copy link

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-
Copy link
Contributor

luke- commented Jan 21, 2021

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
Copy link
Author

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-
Copy link
Contributor

luke- commented Jan 21, 2021

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
Copy link

steffes commented Jan 22, 2021

@mechiles check out this issue humhub/humhub-modules-fcm-push#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
Copy link
Author

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

@mechiles
Copy link
Author

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

@samuk
Copy link

samuk commented Aug 26, 2021

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

@mechiles
Copy link
Author

@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
Copy link

samuk commented Aug 26, 2021

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

@mechiles
Copy link
Author

mechiles commented Aug 26, 2021 via email

@JK742020
Copy link

@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
Copy link

steffes commented Oct 17, 2021

@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:

  • Enroll in Apple Developer Program for $99
  • Get a physical iOS device. Remote notifications not allowed in iOS Simulator
  • Create Apple Push Notification Service Certificate, iOS Distribution Certificate (App Store)
  • Create an App Group with Push Notifications enabled
  • install fcm-push and rest humhub module in HumHub
  • refactor swagger yaml within rest module to OpenAPI 3.0 to enable jwt
  • use the swagger cli to dereference the yaml files into 1 file
npm install swagger-cli -g
swagger-cli bundle --dereference activity.yaml --outfile activity.json
nswag swagger2csclient /input:activity.json /classname:ActivityService /namespace:CustomHumHub.Services /output:../ActivityService.cs
  • Create a Xamarin.iOS project including a Notification Content Extension and Notification Service Extension

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
Copy link

JK742020 commented Oct 18, 2021

thanks steffes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants