Search code examples
google-apps-scriptgmail-addons

Determine where a gmail add-on is running


I'm developing an add-on for gmail and I'd like it to show different texts depending on whether it's running on the browser or on the android app, but I don't know if it's possible.

I've tried using HtmlService.getUserAgent() and the deprecated UiApp.getUserAgent(), but both of them return null; and I haven't found any other possibilities on the documentation.

Can anyone help on this? Thanks!


Solution

  • Solved. The function provided as onTriggerFunction of the appsscript.json file has an event parameter with a clientPlatform property that can be either 'web' or 'android'.