Push notification no webview - Android / iOS

Asked

Viewed 1,012 times

1

I have an app running a webview. It’s a web system and the webview with the app.

In the system, it has certain actions that the system sends push notification to the user.

I made the integration with firebase cloud messaging Javascript. But it does not work in webview, only accessing directly from the browser.

For what I was researching, I would have to configure the javascript part, for web, and in webview configure it again to work in webview, but my knowledge of Java is very little, and I use the database on the web to send the push.

Does anyone know if I can do this integration via Javascript and work in both the browser and webview?

  • I believe that the problem of this is that webView could not be destroyed, for example if close the app or then idle time finish it (cell phone consumption management does this because of battery and performance) when placed in the background for a long time or opens another heavy app or while your app is open webView will be able to notify, if not closed. The ideal would be to create a Task (background service) that would read a json format and send pushs, totally independent of webView.

1 answer

1

Java is not well embedded in an iOS App. What you can do is go in your method that gets Push Notification (if you don’t have it, just implement it in Appdelegate, because it should have).

And then, instead of Webview, try using the Csafariwebkit. Apple recommends not to mislead your user using webview if the content is web. The exception is if you need something more customized and the screen is entirely from your app.

In your file

import CSafariWebKit

And wherever you want to call Webview

let vc = SafariViewController(url: url, barTintColor: nil, tintColor: nil)
vc.presentSafari(fromViewController: self, whenDidFinish: nil)

Use the colors of your app for a better experience.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.