You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Andalusio (via GitHub)" <gi...@apache.org> on 2024/03/09 07:54:18 UTC
[I] What does "if user hasn't tapped on the frame or any embedded frame yet." Mean? [cordova-plugin-vibration]
Andalusio opened a new issue, #117:
URL: https://github.com/apache/cordova-plugin-vibration/issues/117
This issue is with Android, and not even Google Gemini could help figure out how to get navigate.vibrate to work by adding "touchend" via "addEventListener." I feel like this will never be available on Android, and I needed this for a gimmick in one of my games.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
Re: [I] What does "if user hasn't tapped on the frame or any embedded frame yet." Mean? [cordova-plugin-vibration]
Posted by "Andalusio (via GitHub)" <gi...@apache.org>.
Andalusio commented on issue #117:
URL: https://github.com/apache/cordova-plugin-vibration/issues/117#issuecomment-1991105886
Never mind. With help from Google Gemini, I figured a way of just using tapping on the screen in general to trigger vibration. In case you're interested, here is an example:
`var isUserInteracted = false; // Flag to track user interaction
document.addEventListener("touchstart", function() {
isUserInteracted = true; // Set flag upon user interaction
});
var intervalId = null; // Variable to store the interval ID
function checkAndVibrate() {
if (isUserInteracted) {
navigator.vibrate(kickTime);
}
}
function startInterval() {
if (!intervalId) { // Start the interval only if not already running
intervalId = setInterval(checkAndVibrate, 1); // Interval duration is 1 millisecond
}
}
function stopInterval() {
if (intervalId) {
clearInterval(intervalId);
intervalId = null;
}
}
// Start the interval after user interaction
chatbodyObj.addEventListener("touchstart", startInterval);
// Stop the interval when necessary (e.g., on game exit)
// ...`
Maybe something like this should be included into the readme under the Android section? Again, it took Google Gemini to know a work-around to the restrictions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
Re: [I] What does "if user hasn't tapped on the frame or any embedded frame yet." Mean? [cordova-plugin-vibration]
Posted by "Andalusio (via GitHub)" <gi...@apache.org>.
Andalusio commented on issue #117:
URL: https://github.com/apache/cordova-plugin-vibration/issues/117#issuecomment-1991321037
Of course, the above code examples are ideal for working with intervals, which was what I was looking for for an in-game gimmick I had in mind.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
Re: [I] What does "if user hasn't tapped on the frame or any embedded frame yet." Mean? [cordova-plugin-vibration]
Posted by "jcesarmobile (via GitHub)" <gi...@apache.org>.
jcesarmobile commented on issue #117:
URL: https://github.com/apache/cordova-plugin-vibration/issues/117#issuecomment-1991468455
You don't really need any of that code, you can still call vibrate even before the user touched the screen, it will just not vibrate and will return false
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
Re: [I] What does "if user hasn't tapped on the frame or any embedded frame yet." Mean? [cordova-plugin-vibration]
Posted by "jcesarmobile (via GitHub)" <gi...@apache.org>.
jcesarmobile closed issue #117: What does "if user hasn't tapped on the frame or any embedded frame yet." Mean?
URL: https://github.com/apache/cordova-plugin-vibration/issues/117
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org