Basic app using G-Sensor - Help - Android Software Development

Hi guys,
I have a really great idea for a simple app using the g-sensor however I have no idea how to program. All it has to do is recognize when the handset has been rotated on each axis. I presume it is possible also use the compass to detect a 180 degrees rotation without flipping the device too.
All it has to do is recognize which way the phone has spun and play a sound / briefly display a graphic for a few seconds immediately after.
I might actually like to make this commercially, so I won't go into too much detail, but if anyone would like some money from potential revenue and thinks they could do this without too much trouble then please get in touch by PM. I can throw together all the graphics myself pretty easily so it's just the coding really.
Cheers,
Mike

Related

Vue FLo and Screen Orientation

Might be jumping the gun a bit but does anyone else agree that HTC should have thought of some form of tool that controls screen orientation based on Vue Flo, most tablet PC's have this functionality so it would have been nice.
If this exists can someone point me in the right direction.
I thought it did sometimes, but it could just be my handset being random/changing orientation due to me knocking the keyboard when rotating it.
I want to see a game use the i2C sensor that provides the tilt sensing
This happened with the Mac remember? Turns out it was a standard part that had 3 axis!
I hope somebody can look into this for the Ameo(Athena) because the right driver could make it into a digital/Analogue controller for games on the device.
How about old school Marble madness in Mame with tilt control? hehe.
As long as there is an on/off for it. I could see myself changing orientation all the time by accident, and after a while, I bet it would become very frustrating. Well, for me, anyway.
mysticbluebmw said:
As long as there is an on/off for it. I could see myself changing orientation all the time by accident, and after a while, I bet it would become very frustrating. Well, for me, anyway.
Click to expand...
Click to collapse
you can turn Vue FLo on/off when you are browsing already
I would love it if there was a hack that redirects the scroll ability to the regular scroll bars such that any application on the device with more than a screen-full data to show could use Vue Flo.

Problems with screen calibration

Hi people!
I have a problem with the screen of my touch dual. After some hours it loses the calibration and it thinks you have pressed a bit more to the left, making impossible to close programs with the "X" and making more difficult to use the camera among other things.
I have the service manual, but I didn't find any way of readjusting the touch screen. Does anybody know how it's done?
Thanks
It's a common habit for touch screens to lose alignement.
So they made a way to re adujst it. Just go to Settings/screen then proceed with the adjustment procedures.
But if this happen too mnay often, there may be something wrong with screen itself or a faulty application
Yes, I thinks something happens with the screen, as it happens too often and sometimes when you move vertically the Nike thinks I have draw some kind of doodle
Well, I guess it needs to go to the mechanics

What is G-Sensor?

i couldnt find a thread that explains exactly what it was... is it hardware or software...
hardware. I think its a type of accelerometer.
my wife is also interested in this.
so my phone wouldnt have it then.. doesnt the camera have some kinda sensor like it in it?
your wife needs to get a diamond or touch pro...
andason said:
my wife is also interested in this.
Click to expand...
Click to collapse
gotvitamink said:
hardware. I think its a type of accelerometer.
Click to expand...
Click to collapse
As far as I know it IS an accelerometer. Same thing I would say. Don't have much knowledge, but it's basically the same technology the iPhone uses. It can detect how you're holding your phone. Yes, you could use your front camera on your phone as a accelerometer and it's been asked before, but no one attempted to do so since it would consume too much battery.
Kraize92 said:
As far as I know it IS an accelerometer. Same thing I would say. Don't have much knowledge, but it's basically the same technology the iPhone uses. It can detect how you're holding your phone. Yes, you could use your front camera on your phone as a accelerometer and it's been asked before, but no one attempted to do so since it would consume too much battery.
Click to expand...
Click to collapse
yea i wasn't really sure if it differed from an accelerometer. I used google and wikipedia and i couldn't find anything on G-sensor, and I didn't find G-sensor under the accelerometer wikipedia entry.
but yea, basically the technology that iPhone uses.
someone should do it...
its an accelerometer which is hardware to do what the iphone does where when u turn it to its side its screen also changes to the sideways orientation.
It detects which way the phone is facing and can detect acceleration in 3 axis.
petard said:
It detects which way the phone is facing and can detect acceleration in 3 axis.
Click to expand...
Click to collapse
Ah, there is the more technical answer. It can detect movement. Basically you use the 3 axis which detects movement in all directions. You tilt left and right and you tilt up and down. I knew that just didn't know the technical meaning lol.
In most cases the G-Sensor is simply a small metal ball laying in a tub with several contacts. When you turn or move your phone, the ball moves also, connecting some of these contacts to anothers. So the phone can figure out how you hold it (portrait or landscape, upside down etc.) and can switch the screen or perform different actions. Its called G-Sensor because the ball is driven by G-Force.
What is G-Sensor ?
A G sensor is usually an accelerometer. It measures the forces that act on it during changes in velocity. The wiki article below has more details.
Source(s):
http://en.wikipedia.org/wiki/Accelerometer
Dennis78 said:
In most cases the G-Sensor is simply a small metal ball laying in a tub with several contacts. When you turn or move your phone, the ball moves also, connecting some of these contacts to anothers. So the phone can figure out how you hold it (portrait or landscape, upside down etc.) and can switch the screen or perform different actions. Its called G-Sensor because the ball is driven by G-Force.
Click to expand...
Click to collapse
False. It's a three (and probably sometimes two) axis MEMS accelerometer - there are a few companies making those, but probably the most popular ones are analog devices' ADXL series. Similar device sits in wiimote (just as a secondary motion detection system, the more accurate one is camera+sensor bar).
Because these chips became really cheap recently, and are way more accurate, reliable, and robust than any mechanical sensors (in the same price ans size range), they're being shoved in every possible device You can find them in digital cameras (used to recognize if the photo is portrait or landscape and tag it accordingly), in hard drives (to detect mechanical shocks and protect the hdd by parking its head), in laptops (usually same as above plus to detect when the computer is falling down or other dangerous situations and protect the hard drives), in cell phones (you probably know this one's uses), in toys, portable media players, and lots of other stuff.
It detects which way the phone is facing and can detect acceleration in 3 axis.
Click to expand...
Click to collapse
A more precise answer is that it detects acceleration in three axes, and from these values phone's orientation can be calculated.
[MORE DETAILED EXPLANATION]
It's rather simple - when the phone is normally handled (it's not free falling and it's not being waved around), the dominant acceleration detected by the accelerometer is the gravitational acceleration (-9.81m/s^2 in vertical axis). So, if most of the time acceleration detected along the vertical axis of the phone is bigger than one detected along horizontal axis, the phone is being held in landscape position. If the situation is reversed, it's held in portrait orientation. If the acceleration is largest in the third axis (tangent to the screen), it means that the phone is being held nearly horizontally or it's lying on some surface - better not change screen orientation then
But as i said - it's only true when the dominant acceleration is the gravitational one - the sensor can't tell it from other sources of acceleration like waving the phone around. If you run one of the g-sensor games or demos and try quickly moving the phone around the desk (keeping it horizontal at all times), you'll see that the game will interpret this movement as tilting the phone.
[/MORE DETAILED EXPLANATION]
And by the way, why is this thread in development and hacking?
mr_deimos said:
False. It's a three (and probably sometimes two) axis MEMS accelerometer - there are a few companies making those, but probably the most popular ones are analog devices' ADXL series. Similar device sits in wiimote (just as a secondary motion detection system, the more accurate one is camera+sensor bar).
Because these chips became really cheap recently, and are way more accurate, reliable, and robust than any mechanical sensors (in the same price ans size range), they're being shoved in every possible device You can find them in digital cameras (used to recognize if the photo is portrait or landscape and tag it accordingly), in hard drives (to detect mechanical shocks and protect the hdd by parking its head), in laptops (usually same as above plus to detect when the computer is falling down or other dangerous situations and protect the hard drives), in cell phones (you probably know this one's uses), in toys, portable media players, and lots of other stuff.
A more precise answer is that it detects acceleration in three axes, and from these values phone's orientation can be calculated.
[MORE DETAILED EXPLANATION]
It's rather simple - when the phone is normally handled (it's not free falling and it's not being waved around), the dominant acceleration detected by the accelerometer is the gravitational acceleration (-9.81m/s^2 in vertical axis). So, if most of the time acceleration detected along the vertical axis of the phone is bigger than one detected along horizontal axis, the phone is being held in landscape position. If the situation is reversed, it's held in portrait orientation. If the acceleration is largest in the third axis (tangent to the screen), it means that the phone is being held nearly horizontally or it's lying on some surface - better not change screen orientation then
But as i said - it's only true when the dominant acceleration is the gravitational one - the sensor can't tell it from other sources of acceleration like waving the phone around. If you run one of the g-sensor games or demos and try quickly moving the phone around the desk (keeping it horizontal at all times), you'll see that the game will interpret this movement as tilting the phone.
[/MORE DETAILED EXPLANATION]
And by the way, why is this thread in development and hacking?
Click to expand...
Click to collapse
How do you know this surplus of information? Was it from an engineering school / article / books / or phone dissection? How do you know this?
None of these answers made much sense, so I did a google search, found the following:
http://www.dimensionengineering.com/accelerometers.htm
poetryrocksalot said:
How do you know this surplus of information? Was it from an engineering school / article / books / or phone dissection? How do you know this?
Click to expand...
Click to collapse
The theory of operation is actually pre-high school level stuff - basic physics (you know, Newton's laws, and theory of gravity)
And the details - caught some of these at the engineering university, some from accelerometer datasheets. I had to interface one of them to a programmable microcontroller a while ago so i needed to do some research on my own
I just got a TP2 and is a bit confused as to the working of the G-Sensor. I have calibrate it (and it is switched on), but nothing happens when I turn the phone sideways - ie turning to landscape mode. Am I missing something or need to activate it somewhere else?
Thanks
stoutseun said:
I just got a TP2 and is a bit confused as to the working of the G-Sensor. I have calibrate it (and it is switched on), but nothing happens when I turn the phone sideways - ie turning to landscape mode. Am I missing something or need to activate it somewhere else?
Thanks
Click to expand...
Click to collapse
Hello, try to search on your programs, you will have "G-Config", it allows you to define which applications rotate.
Thanks very much. I searched but couldn't find any G-Config anyware in All programs. Only reference is the G-Sensor in All settings\System.
EDIT: Google reveiled G-Config to be a self written app. (just downloaded) So it's not a HTC app included in the ROM?

light sensor app like Iphone (incall screen off)

I was wondering if there's a app that allows the screen to turn off when you put the phone to you head? Then when you bring it out and in front of you, it turns back on. My Iphone did that and I loved that feature.
upping cause i'm intersted too
im believe this feature on the iphone is provided by a proximity sensor, you can probable do this with the light sensor but it would only work in the day time bc at night the screen would always be off...
not unless you use the gsensor too? i think if you work with the light sensor and the gsensor..you can get it to work. maybe have it only work when theres a active call.
This is an extremely good idea!
now if I was only a programmer
i'd love to see this feature on my diamond/blackstone too, i always have problems with the cursor jumping somewhere else when taking a note while in call...
theres already a thread about that:
http://forum.xda-developers.com/showthread.php?t=451456
sweet. thanks
I really love that fuction on iPhone as well. I found some program that can adjust the Light Sensor to dim the back light as you want. I never try it but surely not work in the dark. If any news on this issue, pls advise!!
I think the g-sensor is the answer, off course in combination with light sensor. If someone could make an app that would turn off the backlight during an active call AND when phone is in vertical position; this could resolve difficulties with light sensor.
aonavy said:
I was wondering if there's a app that allows the screen to turn off when you put the phone to you head? Then when you bring it out and in front of you, it turns back on. My Iphone did that and I loved that feature.
Click to expand...
Click to collapse
There are a couple out there that attempt to solve the same problem the iPhone does.
One I know of is Touchlock Pro - http://forum.xda-developers.com/showthread.php?t=444215
It is free but it still has a little way to go before it is a polished solution
The other is PocketShield -- http://www.pocketshield.net/
It's not free but I found it so effective for the in-call problem as well as general locking/unlocking that it was worth paying for
I've also, as a developer by trade, played with the light sensor, g-sensor, and stylus sensor APIs and tried to create a basic proof of concept that solved just the in-call problem very well and found that without the approach taken by Pocketshield it just was not reliable enough for me.
fireweed said:
There are a couple out there that attempt to solve the same problem the iPhone does.
One I know of is Touchlock Pro - http://forum.xda-developers.com/showthread.php?t=444215
It is free but it still has a little way to go before it is a polished solution
The other is PocketShield -- http://www.pocketshield.net/
It's not free but I found it so effective for the in-call problem as well as general locking/unlocking that it was worth paying for
I've also, as a developer by trade, played with the light sensor, g-sensor, and stylus sensor APIs and tried to create a basic proof of concept that solved just the in-call problem very well and found that without the approach taken by Pocketshield it just was not reliable enough for me.
Click to expand...
Click to collapse
All these programms are great software but are nowhere near the iphone solution... like i already said, the problem is e.g. that if you are on the phone and the person on the other end tells you a phonenumber you need to write down - the cursor always jumps to somewhere else as soon as you put your phone back to your ear (and then take it away again ofcourse to continue to notice the number).
ive messed with those apps before with no luch for what i was looking for. Simple app...JUST for incall and end call. light goesout..then comes back in. those other apps are pretty detaild
pitchbend said:
All these programms are great software but are nowhere near the iphone solution...
Click to expand...
Click to collapse
Very true, but unfortunately this hardware does not have the same sensor as the iPhone so you can only fake it so much.
I'd love to see this developed as well. But just wondering as some have mentioned using the gsensor; what if your laying down using the phone?
any developers out there. this would be awsome. make it simple. only works when the phone is in call. the gsensor sensing the phone from 0-45 degrees and only 0-5% light. seems sorta simple when u look at it like that.
hey everyone. My HTC Touch Pro came with this functionality out of the box. And i really don't like it at all. I think the difference to the iphone is that the screen does not turn back on until the power button is pressed.
millab said:
hey everyone. My HTC Touch Pro came with this functionality out of the box. And i really don't like it at all. I think the difference to the iphone is that the screen does not turn back on until the power button is pressed.
Click to expand...
Click to collapse
My diamond does this already?
mine didnt. very weird.
For what it's worth, S2U2 v.1.42 has an option called "blank screen on call" which essentially disables the touch screen and makes it turn off when a call is connected (both sent and received). To get the screen to turn back on, simply press any hardware button. (Note though that pressing the END button while on a call will end the call as well as turning on the screen.)
I've found this feature to be VERY useful and figured it's as close as we're going to get for the time being .

Gyroscope calibration?

Hi. I have my nexus 6p for 2 days now, and I installed some racing games (NFS no limits, Asphalt 8), which I control using tilt controls (landscape mode).
At first I started to have a feeling, that the phone is unbalanced. I needed to tilt nexus more to upper side of phone to drive straight in game. Then I put the phone on flat surface (on the edge of table to eliminate disturbing effect of camera protrusion) and started the game. The car directly after the start of race (phone still on flat surface), started to steer, and it steers independently from phone landscape orientation, to the side of the bottom end of phone.
IS IT HW FAULT? Or it is normal and I have to calibrate the sensor. Is there any way how can I calibrate gyroscope on flat surface? Thank you in advance for your answers guys!
Really no one know how to solve my problem? I already tried clean reflash with factory image and it doesnt help.
Some of apps have they own gyroscope calibration option, but it doesnt work for the whole system, but only for that app.
Please guys help me.
Hi Predo, I got the same issue like you, I was just searching about this issue and this post came up, have you sent a feedback to google? Just hope they could give us an update to fix this and the speakers imbalance issue.
carzakone said:
Hi Predo, I got the same issue like you, I was just searching about this issue and this post came up, have you sent a feedback to google? Just hope they could give us an update to fix this and the speakers imbalance issue.
Click to expand...
Click to collapse
No, I havent sent feedback to google. A lot of apps have their own calibration feature, so this bug/ HW fault? doesnt bothered me too much. But it would be nice to have a fixing update from google.
mr.pedro said:
Hi. I have my nexus 6p for 2 days now, and I installed some racing games (NFS no limits, Asphalt 8), which I control using tilt controls (landscape mode).
At first I started to have a feeling, that the phone is unbalanced. I needed to tilt nexus more to upper side of phone to drive straight in game. Then I put the phone on flat surface (on the edge of table to eliminate disturbing effect of camera protrusion) and started the game. The car directly after the start of race (phone still on flat surface), started to steer, and it steers independently from phone landscape orientation, to the side of the bottom end of phone.
IS IT HW FAULT? Or it is normal and I have to calibrate the sensor. Is there any way how can I calibrate gyroscope on flat surface? Thank you in advance for your answers guys!
Click to expand...
Click to collapse
You are talking about the accelerometer...
in my case the gyro(rotation sensor) is off, updating to android n didn't fix it.
i hope a factory reset will force recalibrate this.
I really hate to mess with the RMA services in israel since its not google themselves.

Categories

Resources