livecode ios external c++ code for device vibration
This one really simple that it an good one to get your feet wet building your own external Livecode iOS.
Of coarse if you use livecode for iOS development and do not know what an iOS external is or what the external sdk is, you can visit this web page and get more info:
http://www.runrev.com/developers/documentation/externals-sdk/
The whole external sdk for Livecode iOS make any iOS item that an xcode built app can do, possible from livecode, using c, c++, objective-c, objective -c++ etc.
The device vibration is since iOS sdk 4.0 and is part of the Audio Toolbox Audio Services. And one simple command call will trigger it.
name your command in the lcidl file, we can use the following as an example;
command myDoVibrate
we need to import AudioToolbox/AudioServices.h as such;
#import <AudioToolbox/AudioServices.h>
call our command myDoVibrate with in either the .cpp file (cpp is c++ )or the .mm file (mm is objective c++)as such;
void myDoVibrate()
then add the code for such (found in apple ios developer documentation) like this;
{
AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);
}
So the final c++ code would be;
#import <AudioToolbox/AudioServices.h>
void myDoVibrate()
{
AudioServicesPlaySystemSound (kSystemSoundID_Vibrate);
}
I got you in the ball park, but there only one way to learn. That by finishing it your self. It not that hard and can be easily done. Just say I know I can.
There is of coarse much more harder things that one can do with the external sdk. But If you have not done so yet this is an good one to start you off, and if you have done so then you should have such built in less than 5 minutes.
I see the whole Livecode iOS externals as just another way to extend Livecode with reuse code as an type of module, adding more to your ever growing arsenal of tools.
Have fun, and happy new year.