Is there a way to detect the watch model?
I am interested in positioning text on watch face depending on shape of the face.
I am interested in positioning text on watch face depending on shape of the face.
var deviceSettings = Sys.getDeviceSettings();
// device part numbers come from ${SDKROOT}/bin/devices.xml
var partNumber = deviceSettings.partNumber;
if ("006-B2156-00".equals(partNumber)) {
// fr630
}
else if ("006-B2431-00".equals(partNumber) ||
"006-B2396-00".equals(partNumber) ||
"006-B2397-00".equals(partNumber) ||
"006-B2516-00".equals(partNumber)) {
// fr235
}
// and so on
<!-- resources/device.xml -->
<resources>
<strings>
<string id="DeviceModel">Unknown</string>
</strings>
</resources>
<!-- resources-fenix3/device.xml -->
<resources>
<strings>
<string id="DeviceModel">fenix3</string>
</strings>
</resources>
<!-- resources-fr630/device.xml -->
<resources>
<strings>
<string id="DeviceModel">fr630</string>
</strings>
</resources>
var _cached_device_model = null;
function get_device_model() {
if (_cached_device_model == null) {
_cached_device_model = Ui.loadResource(Rez.Strings.DeviceModel);
}
return _cached_device_model;
}
enum {
FR920XT = 0x0001,
FENIX3 = 0x0002,
VIVOACTIVE = 0x0004,
D2BRAVO = 0x0008,
EPIX = 0x0010,
// add others as they become available
}
var _cached_device_model = null;
function get_device_model() {
if (_cached_device_model == null) {
var model = Ui.loadResource(Rez.Strings.DeviceModel);
if ("fr920xt".equals(model)) {
_cached_device_model = FR920XT;
}
else if ("fenix3".equals(model)) {
_cached_device_model = FENIX3;
}
else if ("vivoactive".equals(model)) {
_cached_device_model = VIVOACTIVE;
}
else if ("d2bravo".equals(model)) {
_cached_device_model = D2BRAVO;
}
else {
_cached_device_model = 0;
}
}
return _cached_device_model;
}
function isDevice(deviceMask) {
return (get_device_model() & deviceMask) != 0;
}
if (isDeviceModel(FENIX3 | D2BRAVO)) {
// device is fenix3 or d2bravo
}
8 year later, i'm creating my first apps, this is useful thanks!