Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,737,490 Members 44,381 Now Online
XDA Developers Android and Mobile Development Forum

Device wakeup by shaking

Tip us?
 
zzattack
Old
(Last edited by zzattack; 9th January 2010 at 01:34 AM.)
#1  
Member - OP
Thanks Meter 1
Posts: 78
Join Date: May 2009
Default Device wakeup by shaking

Kholk mentioned his HD2's hardware buttons didn't work, and we looked into the possibility of waking the device by shaking it. This utility creates a message queue and monitors power notifications. When the device is suspended, this application is put in unattended mode allowing it to continue running. Also the GSensor is requested to stay awake so it can remain to be polled. A few hours of coding resulted in the attached application. Credits go to mligor for this port and OpenNETCF for a good example of creating a message queue in managed code.
The application has no user interface, just start it, suspend ur device by hitting the power button, and shake it to see if it turns on. I don't know the exact impact of this on the battery drain, so I would suggest killing the process or performing a softreset after you've seen the show ;D


Update (06-01-2010): I've added a native version, I think this will perform a little better. It could also be a bit easier on battery drain. Source code also attached.
Update (07-01-2010): added my own installer (with start menu shortcut, source code left out, and updated program). Soft-reset before installing this. This version also prevents multiple instances of the program to be running, causing only extra battery drain.
Update (09-01-2010): fixed two bugs, should now be stable!
Attached Files
File Type: cab Shake'n'wake.CAB - [Click for QR Code] (14.4 KB, 6078 views)
File Type: zip Shake'n'wake_src.zip - [Click for QR Code] (17.4 KB, 1890 views)
The Following User Says Thank You to zzattack For This Useful Post: [ Click to Expand ]
 
arturobandini
Old
#2  
arturobandini's Avatar
Senior Member
Thanks Meter 37
Posts: 1,364
Join Date: Sep 2008
Location: Paris
Great work and nice idea
 
band27
Old
#3  
band27's Avatar
Senior Member
Thanks Meter 1
Posts: 1,371
Join Date: Sep 2008
Location: Toronto
Interesting...will give this a go! thx...

Any hints as far as installation?
 
vodnok
Old
#4  
Member
Thanks Meter 0
Posts: 37
Join Date: Nov 2009
Great job... I hope the sensibility is low cause i don't want to wake my hd2 in my pocket when i'm running
 
jaguaralani
Old
(Last edited by jaguaralani; 6th January 2010 at 09:21 AM.)
#5  
jaguaralani's Avatar
Senior Member
Thanks Meter 582
Posts: 2,064
Join Date: Aug 2007
Location: Perth

 
DONATE TO ME
Quote:
Originally Posted by vodnok View Post
Great job... I hope the sensibility is low cause i don't want to wake my hd2 in my pocket when i'm running

Very Very Nice !

Thanx


A CAB version is attached
Attached Files
File Type: cab Shake n Wake.cab - [Click for QR Code] (10.4 KB, 1224 views)
 
kholk
Old
#6  
Recognized Developer
Thanks Meter 3799
Posts: 2,247
Join Date: May 2007
Location: Torino

 
DONATE TO ME
Thank you mate!
Now I can use my HTC HD2 without problems (and without buying another HD2!)
Lovin' you <3
 
str0g
Old
#7  
Member
Thanks Meter 0
Posts: 88
Join Date: Nov 2009
It would be very useful program if you could add proximity sensor instead of gsensor.
But its first step to something :)
Device: HTC HD2
ROM: Artemis 28 WWE
Android: shubCraft 1.4b
Strorage Card: Silicon Power 16GB cl6
Mods/cool stuff: x2 Taskmanager, Lumos, 4 columns Start menu, Cookie Monster 1.8.5
Headphonse: SE MW600 + Sony EX90LP
 
kholk
Old
(Last edited by kholk; 6th January 2010 at 11:24 AM.)
#8  
Recognized Developer
Thanks Meter 3799
Posts: 2,247
Join Date: May 2007
Location: Torino

 
DONATE TO ME
Unfortunately for me, it works for the first two wakes, then it stops working.
Anyone experienced the same issue?

EDIT: Strange. Now it works ^^
 
lancelot54
Old
#9  
Senior Member
Thanks Meter 0
Posts: 278
Join Date: May 2009
Location: Nancy
It's would be better to add proximity sensor. Keep the shake to wake up, but add proximity sensor. This way, if the phone is shaked, but in the pocket, he will not wake up Take the both for more efficacity isn't?
HTC HD2 - Android CyanogenMod
HP Touchpad (x2) - Android CyanogenMod
 
Pretenderr
Old
#10  
Senior Member
Thanks Meter 1
Posts: 121
Join Date: Jul 2008
Location: Esch-sur-Alzette
Quote:
Originally Posted by lancelot54 View Post
It's would be better to add proximity sensor. Keep the shake to wake up, but add proximity sensor. This way, if the phone is shaked, but in the pocket, he will not wake up Take the both for more efficacity isn't?
agree, otherwise it wakes up when you are walking or running

Tags
gsensor, power management, shake, unattended
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Modernize Your Emails with Email Popup

SMS andHangouts messages likely won’t ever replace traditional Emails for more formal … more

Change Your Toast Notification Style with XToast

Android uses multipletypes of notifications. One of these isknown as a toast notification. … more

Port Sony Xperia Themes to CyanogenMod 11 with Ease

In addition the obvious proficiency with graphics, creating agood Android theme … more

Cell Phone SIM Unlock Bill Just Steps Away from President’s Desk

For all those who believe that Cinderella stories don’t actually … more