Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 8    Views: 95

mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
01/05/14 12:22 PM (10 years ago)

BT30 - Day 03 - Vibrate Function Code

BT30 is my personal project to contribute to buzztouch: https://www.buzztouch.com/forum/thread.php?fid=2348BA49BA5737C92E3D9B5&tid=2348BA49BA5737C92E3D9B5 Day 03 - adding the Vibrate Function to your code Some of you may want to add a vibrate function to your app, whether it be when a "shake" occurs, or when a user presses a certain button, when you call a popup, and so on. Here is the code I used for vibration. // NOTE: You need to import the AudioToolbox framework for access to the vibrate #import <AudioToolbox/AudioToolbox.h> // The one-liner: AudioServicesPlaySystemSound (kSystemSoundID_Vibrate); // The function: - (void)vibrate { AudioServicesPlaySystemSound (kSystemSoundID_Vibrate); } // The call from within another method in the same class: - (void)MYFUNCTION { [self vibrate]; } So there is that code, you can add "[self vibrate];" (without quotations) into any code or plugin you want as long as you include the other code with it somewhere. Doing so will call the vibrate and you will feel your phone vibrate for a second (like when putting the charger on your phone). I find it most useful for when the user shakes their phone using shake code, but can also be used for when the app is refreshed, when a push comes in, the popup menu, all sorts of things. It's up to you to be creative. Hope this is useful for some. Cheers, David
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
01/05/14 12:33 PM (10 years ago)
Very Nice! LA
 
Patrickmotox
Aspiring developer
Profile
Posts: 89
Reg: Dec 10, 2013
Cameron Park, C...
7,090
like
01/05/14 01:09 PM (10 years ago)
Yes. Very Nice.
 
MacApple
Apple Fan
Profile
Posts: 4674
Reg: Oct 25, 2010
USA
61,140
like
01/05/14 02:06 PM (10 years ago)
buzz
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/05/14 03:44 PM (10 years ago)
Slick :) Cheers! -- Smug
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
01/05/14 04:43 PM (10 years ago)
Cool. Thanks!
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
01/05/14 07:29 PM (10 years ago)
a duplicate post from refresh. Wish there was a way to delete...
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
01/05/14 08:25 PM (10 years ago)
If you refresh the same page that you've posted on, before you've 'left' the page, it will repost. Worry not; you're not the first. You won't be the last. It's almost a BT Rite of passage… :) Cheers! -- Smug
 
mrDavid
BTMods.com
Profile
Posts: 3936
Reg: May 21, 2011
San Diego, CA
51,910
like
01/30/14 03:36 PM (10 years ago)
Thanks guys. David
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.