09-23-2022 21:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


09-23-2022 21:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Is there a way to detect if a clock or app is running on the simulator and not s real device?
As there is no vibration detection in the simulator it may be possible to add a flashing icon or some indication on the clock or app but only if running in the simulator.
In the next version it would be good to add vibration support in the simulator via the device speaker or by a inbuilt flashing light.
Author | ch, passion for improvement.

09-23-2022 21:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


09-23-2022 21:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
const isSim = goals.calories === 360
I'm incredibly embarrassed.
This is relying on a bug that might be fixed.
Gondwana Software

09-24-2022 00:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


09-24-2022 00:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@Gondwana- thanks, good to know, however while it does work, it is not quite as simple as that - because it also requires
import { goals } from "user-activity";
const isSim = goals.calories === 360
console.log( "Is the simulator running "+isSim);
if (isSim) myLabel.style.fill = "red";
and adding Activity permissions which otherwise would not be required. So the code needs to be removed before the app is published.
Vibration simulation would be a great testing bonus or failing that a unique Simulator flag.
Will use a simpler solution for testing to just set a flag which is turned on or off before build depending on the intended final target.
Thanks for the find though.
Author | ch, passion for improvement.

09-25-2022 11:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


09-25-2022 11:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
This was the fun solution adopted - it works fine
May even leave it on all the time, especially for a Sense and Versa 3 due to their poor vibration, it gives an additional visual effect to show when a touch has been recognised in case the vibration isn't detected.
const myLabel = document.getElementById("myLabel");
const isSim = true; //Simulate vibration with flashing field in the Simulator
let vibrateCount = 0;
let vibrateID = null;
function vibrate(count) {
if (!isSim) return;
vibrateCount = -count;
clearInterval(VibrateID);
vibrateID = setInterval(vibrateFlash,100);
}
function vibrateFlash() {
vibrateCount++;
if ( vibrateCount == 0 ) {clearInterval(vibrateID); myLabel.style.fill = "white"; myLabel.style.opacity = 1; return;}
if (myLabel.style.fill == "#FF0000") {myLabel.style.fill = "white"; myLabel.style.opacity = 0;}
else { myLabel.style.fill = "red"; myLabel.style.opacity = 1;}
}
Vibrate(3); // equivalent to nudge, etc
Vibrate(0); // equivalent to Alert
Vibrate(1); // equivalent to vibration.stop();
Author | ch, passion for improvement.

