5

Partial PWA support has landed in iOS 11.3 but unfortunately push notification is one of the unsupported features.

Can Apache Cordova be used to wrap a PWA into a native app and add push notification support? How likely/unlikely will the app be approved by Apple to be placed in its app store?

Update: I tried React Native webview but unfortunately I hit another wall. Google OAuth login does not work in a webview. Any workaround?

Update 2: https://codeburst.io/webviews-and-social-authentication-with-react-native-cfecf96ac7d7 this will solve the roadblock above but WebView is slow and RN's implementation is buggy. WKWebKit is better but it has compatibility problem with Firebase Auth JS and still no service worker support.

Henry
  • 32,689
  • 19
  • 120
  • 221
  • 1
    by passing through Cordova will make it into a native app right? There is no point of calling it a PWA anymore. – oninross Apr 18 '18 at 07:06
  • It's still powered by the same pwa code through webview with minimal code change – Henry Apr 19 '18 at 14:41
  • I'm facing this very consideration right now. iOS PWA support being 'half-baked' has me thinking about PWA-only for Android, but Cordova wrapped version for iOS. – Pete Jun 06 '18 at 20:11
  • came across https://www.pwabuilder.com/ but I have not tried it. Looks promising – Henry Jun 07 '18 at 06:14

2 Answers2

2

I did the same but inlaid it into a React Native <WebView>.

Noitidart
  • 35,443
  • 37
  • 154
  • 323
  • Cool, did you also somehow worked out how to polyfil the push notification? Or did you use react-native-firebase? – Henry Jun 14 '18 at 22:56
  • 1
    @Henry Yep I got a ref to the `` and whenever notification happens I do a `postMessage` to it. – Noitidart Jun 14 '18 at 22:57
  • 1
    Did you try Cordova at all? Interested to know why do you pick react native over Cordova if all you use is ``. https://github.com/CRAlpha/react-native-wkwebview this may also interest you? – Henry Jul 11 '18 at 22:41
  • 1
    @Henry the cordova webview is a super webview it has a lot of extra stuff inlaid. I just needed a plain simple webview no extras. Its less overhead. So I'm just guessing faster. I also used Cordova in past for an actual and remember it was quite slow. – Noitidart Jul 11 '18 at 23:43
  • 1
    thanks, I think I will do the same. Was it straight forward? Anything to watch out for? Thanks! – Henry Jul 12 '18 at 14:23
  • 1
    Super straight super easy. Just had to setup RN environment. If you're on a windows machine, RN 0.56.0 is currently not working. They are going to be release RN 0.56.1 soon. – Noitidart Jul 12 '18 at 15:30
  • 1
    I tried RN with WebView today but couldn't get google login to work. Did you have the same problem? How did you work around it? Thanks! – Henry Jul 13 '18 at 18:02
  • Interesting @Henry. I didn't use google login so I can't say. It should work just fine though. – Noitidart Jul 13 '18 at 19:24
  • it does not work because https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html. Looks like I need to also bake the React Native Firebase Auth module into it. – Henry Jul 13 '18 at 21:33
  • Oh dang why is that though? if it's just web – Noitidart Jul 13 '18 at 21:47
  • fwiw, I really tried but it's not good enough for me 'cause A) webview onmessage is super buggy, and B) wkwebview is incompatible with firebase auth JS and no service worker support as well. Sigh... – Henry Jul 17 '18 at 17:20
  • 1
    Dang that's interesting, thanks very much for sharing those insights. – Noitidart Jul 17 '18 at 20:38
  • 1
    I ended up with wkwebview with react native firebase auth and messaging. Works pretty well now. – Henry Jul 24 '18 at 05:14
0

I just tried it. I made a PWA with web push using quasar-framework. It runs smoothly but I want it to be in the play store, so I used a pure webview wrapper. Web push doesn't work with that.

So in the next step I tried to create a cordova app with phonegap-push-plugin. That does work, but the files are all on the device and so the advantage of the PWA is away.

Next step, I just changed the start url to point to the PWA in web, but then somehow the phonegap-push-plugin doesn't work anymore.

EscapeNetscape
  • 2,892
  • 1
  • 33
  • 32