Add to Home Screen - Hard Prompt

Is there a way that when a user either adds a glide app to the home screen from Safari in Apple OS or on android, that a table could have a column that records that instance?

@david @Robert_Petitto

No, that’s not possible at the moment.

The following in a JavaScript column works for me:

function getPWADisplayMode() {
  const isStandalone = window.matchMedia('(display-mode: standalone)').matches;
  if (document.referrer.startsWith('android-app://')) {
    return 'twa';
  } else if (navigator.standalone || isStandalone) {
    return 'standalone';
  }
  return 'browser';
}

return getPWADisplayMode();
1 Like

@Darren_Murphy how is this implemented? And I thought Java script was totally impossible for glide?

As @Darren_Murphy mentioned, use a javascript column.

Interesting, thanks for sharing!

I assume depends on the use case, say you want to count the number of people that have installed the app, you would have to add actions somewhere in the app to record this? Else it would be dynamic based on whether the user is accessing it from the browser or the installed version.

Yes, that’s correct.
In the App that I’ve used it in, I have a collection on the home screen that’s used for navigation. So I have a custom action on that collection that sets the value returned by the JavaScript into a non-computed column in the User Profile table.

1 Like

Can you provide a video/more screenshots please?
I tried this in the Javascript column but it didn’t work for me.

JavaScript column looks like so:

Then as previously described, I have an action that writes the value into a non-computed column.
Note that in the screen shot, it’s returning browser for every row. That’s because the screen shot is taken whilst viewing the App in the builder.

Thank you!
So I did this previously and got this result. Then I added a button (with the js as the data for it) but the button didn’t do anything. There was no prompt at all.

I don’t really understand what you were doing (or trying to do) with the button, can you explain more?
What were you expecting the button to do?

I wanted the button to add the app to a user’s home screen.
It does not do that nor prompt them to do that

oh, right. I don’t believe there is any way to do that with an action.

1 Like