mobileVibrate Command
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 72
- Joined: Sat Apr 06, 2013 8:09 am
- Location: London
mobileVibrate Command
I want to write n App for Android that makes my phone Vibrate
I've found the command mobileVibrate
And seen the example in the dictionary that says mobileVibrate 7 will get your phone to vibrate 7 times
But what I want to do is get my phone to Vibrate for different lengths of time - sort of like Morse Code style - long and short vibrations
like maybe vibrate 1 seconds, then 2 seconds, etc - is this possible?
Also I get an error when I run the code below (using Windows 7):
on mouseUp
beep 7
mobileVibrate 7
end mouseUp
button "Button_Beep": execution error at line 3 (Handler: can't find handler) near "mobileVibrate", char 1
What is causing the above error?
is it because I'm trying to run a command for mobile phone in Windows or something else?
I've found the command mobileVibrate
And seen the example in the dictionary that says mobileVibrate 7 will get your phone to vibrate 7 times
But what I want to do is get my phone to Vibrate for different lengths of time - sort of like Morse Code style - long and short vibrations
like maybe vibrate 1 seconds, then 2 seconds, etc - is this possible?
Also I get an error when I run the code below (using Windows 7):
on mouseUp
beep 7
mobileVibrate 7
end mouseUp
button "Button_Beep": execution error at line 3 (Handler: can't find handler) near "mobileVibrate", char 1
What is causing the above error?
is it because I'm trying to run a command for mobile phone in Windows or something else?
Re: mobileVibrate Command
Hi,
No, I don't think that's possible. The API that manages the vibration has only one command to make the phone vibrate. In Objective-C, you need to use arepeat loop if you want to make the phone vibrate for a long time. That's what LiveCode does: mobileVibrate 7 makes the repeat loop run 7 times. There doesn't seem to be another way.
Kind regards,
Mark
No, I don't think that's possible. The API that manages the vibration has only one command to make the phone vibrate. In Objective-C, you need to use arepeat loop if you want to make the phone vibrate for a long time. That's what LiveCode does: mobileVibrate 7 makes the repeat loop run 7 times. There doesn't seem to be another way.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: mobileVibrate Command
Hi guys,
according to the doc, thiks is possible on iOS and Android!
The ERROR is caused from the fact that the IDE does NOT recognize MOBILE ocmmands and will throw an error when it encounters one!
I think this is completely stupid, but that's the way it is...
You will always need to use IF... THEN... with native mobile commands:
Best
Klaus
according to the doc, thiks is possible on iOS and Android!
The ERROR is caused from the fact that the IDE does NOT recognize MOBILE ocmmands and will throw an error when it encounters one!
I think this is completely stupid, but that's the way it is...
You will always need to use IF... THEN... with native mobile commands:
Code: Select all
on mouseUp
beep 7
## ONLY execute this on the mobile simulator or real device:
if the environment = "mobile" THEN
mobileVibrate 7
end if
end mouseUp
Klaus
Re: mobileVibrate Command
Hi Klaus,
On iOS, the command mobileVibrate N is possible (where N is an integer). However, when you execute this command, you will get N times a brief vibration. It is impossible to get long and short vibrations in the sense of morse code.
Kind regards,
Mark
On iOS, the command mobileVibrate N is possible (where N is an integer). However, when you execute this command, you will get N times a brief vibration. It is impossible to get long and short vibrations in the sense of morse code.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: mobileVibrate Command
Hi Mark,
oh, yes, sorry, my fault, need to read more carefully!
Best
Klaus
oh, yes, sorry, my fault, need to read more carefully!
Best
Klaus
Re: mobileVibrate Command
That's ok, Klaus. I guess my answer wasn't complete.
Mark
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode