Questions tagged [shake]

An effect or gesture of rapid vibration. For example, shaking dialog box, shaking cell phone.

An effect or gesture of rapid vibration. For example, shaking dialog box, shaking cell phone.

272 questions
343
votes
17 answers

How do I detect when someone shakes an iPhone?

I want to react when somebody shakes the iPhone. I don't particularly care how they shake it, just that it was waved vigorously about for a split second. Does anyone know how to detect this?
Josh Gagnon
  • 5,292
  • 3
  • 24
  • 34
257
votes
16 answers

How to refresh app upon shaking the device?

I need to add a shake feature that will refresh my Android application. All I find of documentation involves implementing the SensorListener, but Eclipse tells me it's deprecated and suggest SensorEventListener. Anybody that has a nice guide to how…
Sara
  • 3,723
  • 6
  • 23
  • 29
28
votes
5 answers

How to animate button in android?

I am making an android app, and I have a button which leads to a messaging place. On the activity with the button, I check if there is any unread messages, and if so I want to do something to the button to let the user know that there is something…
omega
  • 30,811
  • 68
  • 188
  • 388
24
votes
4 answers

iOS : How to detect Shake motion?

I added the following code to my appDelegate.m - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event { } - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if (motion == UIEventSubtypeMotionShake ) { …
Samblg
  • 967
  • 2
  • 9
  • 15
18
votes
3 answers

How to pass a boolean between intents

I need to pass a boolean value to and intent and back again when the back button is pressed. The goal is to set the boolean and use a conditional to prevent multiple launches of a new intent when an onShake event is detected. I would use…
Carnivoris
  • 773
  • 3
  • 7
  • 23
15
votes
3 answers

How to use Shake API in iPhone SDK 3.0?

Apple annonced Shake API in iPhone SDK 3.0. I can not find any information regarding this new feature. Who knows about how to use it? Any example, link will be good.
sashaeve
  • 8,609
  • 9
  • 45
  • 59
14
votes
4 answers

How to detect shake motion in iPhone

On the shake of the iPhone device i want some function to be called, i dont know how to recognize shake so i tried some link and tried this code - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event { if(event.type ==…
Radix
  • 3,599
  • 3
  • 28
  • 47
13
votes
1 answer

Android buttonimage shake animation

I am new with android and im looking for a way to shake my buttonimage on click. I got this so far but it crashes all the time. Or if you click it nothing works. I hope you people can help me out. if i forgot anythiing just say it. code can be…
The M
  • 611
  • 1
  • 6
  • 23
11
votes
2 answers

Detecting shake in AppDelegate

How can I detect a device shake in the AppDelegate (across the entire app) in Swift? I've found answers that describe how to do so in a view controller, but looking to do so across my app.
Liran Cohen
  • 184
  • 2
  • 9
10
votes
1 answer

Objective C: Detecting a shake

I'm using the shake api like this: - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if (event.subtype == UIEventSubtypeMotionShake) { [img stopAnimating]; } } How do I detect that the shaking has…
Chris
  • 6,863
  • 17
  • 64
  • 108
9
votes
1 answer

iPhone app increase shake gesture sensitivity

In my iPhone App I have used shake gesture it is working but it requires lots of efforts to shake. Is there any way to make it more sensitive? Here is the code - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if…
ios
  • 6,004
  • 18
  • 69
  • 100
9
votes
1 answer

UI Tests: Simulate a shake gesture with Swift

Using UI tests, I'd like the app to respond to shake gestures, and I would like to programmatically trigger a shake gesture in my swift UI tests. Triggering the shake gesture while recording during a UI test session yields no added code. Is there a…
Noah
  • 1,359
  • 12
  • 26
9
votes
4 answers

Javascript. Listen for iPhone shake event?

Is it possible to listen for an iPhone (or any mobile phone with accelerometer) shake event with JavaScript? You know like shaking the iPhone to shuffle the next song in iTunes I want to call a JS function on my website when the iPhone got shaken.
matt
  • 37,699
  • 99
  • 250
  • 390
7
votes
1 answer

How to create an android app that activates on shake events when screen locked?

I want to create an app that **starts the Main activity whenever the device shakes, even when screen locked. Can anyone explain how to do that? I have an idea that it requires to create a service that runs in background, but I am struggling with…
SHD
  • 101
  • 2
  • 5
7
votes
1 answer

Detecting shaking in html5 mobile

I'm building a web app in html5 at the moment that needs to be able to detect when the user shakes their phone and how fast they are shaking it. I've been browsing around but can't seem to find any examples of how I could implement this. I know…
Jessica Stanley
  • 199
  • 1
  • 4
  • 12
1
2 3
18 19