How to detect platform using Ionic 4

You can use Capacitor’s Device API:

import { Plugins } from '@capacitor/core';

const { Device } = Plugins;

const info = await Device.getInfo();
console.log(info);

It outputs platform:

{model: "Macintosh", platform: "web", appVersion: "", osVersion: "10.14.5", manufacturer: "Google Inc.", …}