How can I set the app name that shows up in a PWA web push notification? - progressive-web-apps

I'm trying to figure out how to set the app name of what shows up in a PWA web push notification.
The PWA already shows up in the apps installed list and shows up on the home screen with the app name.
It can receive web push notifications, but what I'm curious about is how to change the part that says Chrome and myexamplesite.com (blurred in the image below)
Normally the notification will show something like Chrome ● myexamplesite.com ● now
I know that the Chrome badge can be set with the badge argument, but what about the part that says Chrome and the website url? Can that be somehow set to be something like My App Name?

I guess the Chrome part is not changeable since it comes from the client browser. And the title seems to come from your App name.

AFAIK you cant change the 'Chrome' title in the notification because the PWA depends on your browser, but you can set the notification title using registration.showNotification(title, options)

Push Notification it's part of the mobile OS system API
It's because the notification is from Chrome App (doesn't matter what logic is inside is it its own Chrome notification or PWA)
The logic is the next: the mobile App registers in the mobile (iOs/Android) system with its name and icon (or some other declared in specific files like 'manifest' in PWA) with a set of permission/access rules/etc, e.g. allow the App to create Push Notifications in the system. It makes once, the name of the App and icon could be changed by itself but it will be changed everywhere in the system.
In this case, to change the Push Notification 'app name' the App should change it globally.
The title, subtitle, image, text, and body/metadata could be set dynamically and Chrome gives the API for it.

Related

when the dynamic link is opened from browser(especially in safari) it is always redirecting to the app store even though app is installed in iOS

My URL is same as below, i will get this link to my mail from sendgrid and in iOS when i tap on this it always loads the browser first (safari most of the case) and opens in app preview page even though app is installed.
URL:<a clicktracking="off" href="https://{project_name}.page.link/?link=https://{project_name}.page.link/users/email_check/{{ $email_token }}&apn=com.{project_name}.app&isi={applestoreid}&ibi=com.{project_name}.app&efr=1">https://{project_name}.page.link/?link=https://{project_name}.page.link/users/email_check/{{ $email_token }}&apn=com.{project_name}.app&isi={applestoreid}&ibi=com.{project_name}.app&efr=1</a>
When you access a dynamic link in a browser. It will intentionally not go to your app because the actions indicate that your intent is to open a web page.
If you have your custom domain from Firebase ie: [your custom domain].app.goo.gl, send it into your link like so:
https://[your custom code].app.goo.gl/
And then tap that link. Does it open the app, or does it go to Safari? If it goes to Safari, it means that you haven't configured your iOS app for universal links yet, which is needed to support opening your custom domain url directly in the app. In Xcode, go to the Capabilities tab, and ensure that you've added the universal link domain as described in Apple's docs.
If you tapped the site address on the far top-right on iOS, it disables universal linking on that iOS app, until you long-tap and ask to open in the app again.
Second, you can't type in universal links into Safari's address bar and navigate to the app. Safari, by design, will open that URL in the browser. The easiest, most reliable way to test whether universal links are working is to put a universal link into the app, and tap the link from there.

Can a flutter app run code on receiving a push notification while Not Running

I have push notifications working and have both a data and notification part in them. In the data part is a tag that tells the app what updates are available for the user.
The problem is that I would like the app to fetch those updates even if the user does not tap on the notification.
With other apps, eg Whatsapp, a notification is shown. Without tapping this notification, and even when the app is not running, the app downloads the data. For example if the user switches to flight mode right after receiving the notification and then opens whatsapp, the message and/or picture is there, already downloaded and displayed in the app.
So the question is how to get an app written in Flutter to download something in response to getting a push notification, regardless of whether the app is in the foreground, background, or not running.
Checkout isolate mentioned in Flutter background processes with a link to Medium Executing Dart in the Background with Flutter Plugins and Geofencing
Checking with GitHub issue Flutter should provide an abstraction for background execution and issue comments/references after that you may find some other examples. Bottom line is people need more examples.

Manage pages displayed in Progressive Web Apps ( PWA )

I am new to PWA and was just going through some readups. We have public website and in the website we provide login for users to manage their account. By going with PWA, I understand that users can save the website on the mobile homepage as an icon. My question is that , when user click on my PWA icon , can we load the login page for the users so that they can only manage account with PWA instead of loading entire website.
The Web App Manifest allows you to control how your app appears and how it's launched. You can specify home screen icons, the page to load when the app is launched, screen orientation, and even whether or not to show the browser chrome.
The web app manifest is a simple JSON file that gives you, the developer, the ability to control how your app appears to the user in areas where they would expect to see apps (for example, a mobile device's home screen), direct what the user can launch, and define its appearance at launch.
You can define how your app is launched, add a query string parameter to the start_url that indicates how it was launched.
"start_url": "/?utm_source=homescreen"
Hope this helps!
Yes you can, within your web app manifest file you can set a JSON property called "start_url".
There's further information here https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/#set_a_start_url

Chrome Packaged Apps: Opening another app

I am wondering whether there is any JS API to start another chrome app on button click event in a chrome packaged app.
As a general rule, no, you can't invoke another app.
However, if you control both apps, you can set the second app to expect an external message.
You can add chrome.runtime.onMessageExternal listener to the second app's event page script, and send a message with the app ID from the first to wake the second app and launch the app window. See this for more details.
In general, an extension can do this task and more thanks to the management API. It is, however, unavailable for Apps as of now.
Feature request to add this API for apps: #455550

Return to app from safari

In my application, I redirect the user to the safari browser when he/she taps on a button, which in turn closes the application and opens the safari browser. There is no problem in that. It works fine. The thing is when the user quits the safari browser, I want to redirect the user back to the application, not the home screen. Any idea please...
If you control the website that you are redirecting them to, then you can place a link on the site using custom URL which I describe in more details below. But if it's a site you don't control, you can have the user surf within your app using the UIWebView.
For an iOS app, you can create custom URL schemes that your app register with the system. Then on the web page you would create a link using that custom URL. That is how Apple launches the telephone.app or the mail.app from mobile safari.
For example: Let say your app is call BigBadApp. You custom URL would be: bigbadapp:// Now, you could create a link to your app would be: Launch BigBadApp You can pass any kind of information back to your app using the custom URL and your app will handle that information in the app delegate. For iOS 4.2 and later: application:openURL:sourceApplication:annotation:. The name of old delegate on earlier version of iOS is application:handleOpenURL:
For more information see check Apple Implementing Custom URL Schemes.
Also iOS developer:tips has a tutorial on Launching Your Own Application via a Custom URL Scheme.
You can't. When you redirect someone out of your application the only way to get back is using the task switcher or opening your application from the home screen again.
If you want to keep the user in your application you could open the web pages in a webview within your application
use UIwebViewController . that represent web link within app . so that your app wont be in back ground and add back button in navigation bar on click back button navigate to back screen . i guess it would be better
i would launch an in app browser...
this is a good uiviewcontroller subclass that has most of the browser functions already implemented. its very easy to use.
https://github.com/samvermette/SVWebViewController