shake

unable to detect shake event when my phones screen is off in android

帅比萌擦擦* 提交于 2019-12-03 09:00:29
In my application I want to detect the shake event and I'm using SensorEventListener, the code is working fine when my activity is running in foreground. But when I press the lock button of the phone to lock the screen, the shake event can't be detected. I have tested my code on the Samsung gts5360. But the same code is working fine on sony ericssion xperia mini pro. Actually my Samsung phone is not detecting the shake events when I leave the device idle for approx. 45 seconds, after locking the device. Then I shake the phone, it does not detect the shake, but when I shake phone after several

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

老子叫甜甜 提交于 2019-12-03 07:49:48
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . 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 actual coding and don't know how to do it. 回答1: To create an app

How to animate button in android?

柔情痞子 提交于 2019-12-03 04:54:05
问题 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 unread. I was thinking of having the button sorta vibrate horizontally like 3 shakes every 2 or 3 seconds. I know how to run a thread in the background which does something every x milliseconds. But what I don't know what to do is shake it

iOS : How to detect Shake motion?

社会主义新天地 提交于 2019-12-03 03:42:01
问题 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 ) { // User was shaking the device. Post a notification named "shake". [[NSNotificationCenter defaultCenter] postNotificationName:@"shake" object:self]; } } - (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event { } - (void)shakeSuccess { // do

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

╄→尐↘猪︶ㄣ 提交于 2019-12-02 21:16:49
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. 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 actual coding and don't know how to do it. To create an app which is sensitive to shake event: A. In manifest - register a boot receiver. It will make sure your app will always

iPhone: modifying view when user shakes

拟墨画扇 提交于 2019-12-02 19:43:47
问题 I am developing an iPhone application which deletes rows from a table view when the user shakes the phone. I have created a navigation-based project. Now when the user shakes the iPhone I want the title of the navigation bar to change to "DELETE" and a delete button to appear on the navigation bar, in the same view. Otherwise, when a user selects a particular row it should move to the next view. I have written the following code but it's not working. Please help me out. - (void)tableView:

iPhone: modifying view when user shakes

女生的网名这么多〃 提交于 2019-12-02 10:06:41
I am developing an iPhone application which deletes rows from a table view when the user shakes the phone. I have created a navigation-based project. Now when the user shakes the iPhone I want the title of the navigation bar to change to "DELETE" and a delete button to appear on the navigation bar, in the same view. Otherwise, when a user selects a particular row it should move to the next view. I have written the following code but it's not working. Please help me out. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (isShaked == NO) { //logic

How to shake on android 2.2

不打扰是莪最后的温柔 提交于 2019-12-02 04:18:00
Does anybody know what is the shake code for android 2.2? I want on shake to make buzz on my application. Thanks. Mark Byers Try this: /* put this into your activity class */ private SensorManager mSensorManager; private float mAccel; // acceleration apart from gravity private float mAccelCurrent; // current acceleration including gravity private float mAccelLast; // last acceleration including gravity private final SensorEventListener mSensorListener = new SensorEventListener() { public void onSensorChanged(SensorEvent se) { float x = se.values[0]; float y = se.values[1]; float z = se.values

How to pass data from one View to other view in IOS using UIStoryboard segues?

送分小仙女□ 提交于 2019-12-01 13:06:22
I am using Xcode 4.3.1 . I have created the UI using Storyboard which has many View Controllers. Issue In my app i am using ShakeGesture. While shaking i am doing some operations, its working fine. But, when shaking get stopped i need to pass some values to another View controller to display it. I have seen many post it says how to pass value when button clicked,but no one related with my problem. It would be great if you solve my issue My question is How to pass values from one View to another View controller after shaking get stopped? I am looking for any examples or tutorials. Much

detect Shake in android

此生再无相见时 提交于 2019-12-01 09:18:52
I am trying to hit an API when user shake a device 10 times. I have tried many git sample and stack overflow solution but non of them did solve my problem. Some of them detecting shake before 10 times or after 10 times. I have tried Seiamic and ShakeDetector libraries. Please give me some valuable solution. I have done that using this library : 1) Add the dependecy in your build.gridle file allprojects { repositories { ... maven { url 'https://jitpack.io' } } } dependencies { compile 'com.github.safetysystemtechnology:android-shake-detector:v1.2' } 2) Give the permission to your app manifest