I need to make some changes to my app but only for iPhone X.
The app is Apache Cordova based (with Ionic framework).
Is there a cordova plugin to detect the iPhone X? If the answer is no, which is the best method to know if the user has an iPhone X in javascript?
Thanks
Check: var deviceInformation = ionic.Platform.device();
From Ionic bundle.js
/**
* @ngdoc method
* @name ionic.Platform#device
* @description Return the current device (given by cordova).
* @returns {object} The device object.
*/
device: function() {
return window.device || {};
},
Also check cordova-plugin-device
Properties
device.cordova // returns CDV_VERSION
device.model
device.platform // always returns iOS
device.uuid
device.version
device.manufacturer // always returns Apple
device.isVirtual // not relevant
device.serial
This plugin calls CDVDevice.m -> UIDevice
so if you still cannot fetch iPhone X
worth to find the way how to detect it in Obj-C and change CDVDevice.m
.
Also check this QA: iOS devices return different format device model, why?