I want to save GPS info into database when the internet connection is off in android.
that information by which the phone detect GPS location.
is this possible?
please advice me..
GPS works without Internet. Internet is only required for A-GPS (to get the position faster when GPS does not know where you are since it's way faster if GPS knows a rough area of your location).
On the other hand there is afik no way to provide that rough position to your GPS since that is not a part of Android's GPS API (GPS is really vendor specific). The implementation might already do that.
If you still want to save that location go look for Database examples - e.g. http://www.vogella.de/articles/AndroidSQLite/article.html
Related
Is it somehow possible in Android to get a count of all the nearby devices which are in active state(i.e. connected to any cellular network)? By that I mean any cellular device which is powered on and installed with a working sim.
The reason why I ask this is because whatever answers I have found so far suggest making use of bluetooth, wifi, nearby or some other custom app. My intention is to just look for devices which are actively connected to a cellular network. Each time I see a device emitting/receiving cellular signals the counter gets incremented.
I tried looking into the Android API as well but could not find something which provides this functionality. NeighboringCellInfo gives information about the device(and its network) on which the app is installed. And this is the closest I could get.
I was thinking that if I can get information about nearby cellular carriers then getting information about nearby cellular device should also be possible. End of the day it's about catching radio waves coming out of something.
Thank you so much for your valuable time. Really appreciate your help!
P.S. : I'm not very not sure if my question makes sense to you all. Please let me know if additional information is needed. I actually come from a totally different background and this is the first time i'm trying to develop a mobile app. Please feel free to correct me if my understanding is wrong.
I'm writing an Android app that I would like to eventually port to iOS and Windows Mobile (though I know absolutely nothing about them right now). I'd like my app to be able to find other phones within a certain radius (maybe 20-30 feet) that also have the game installed so that the users can interact with others in their current physical space. Is this possible and, if so, how?
I plan on the app requiring an internet connection so my first thought was to use GPS like described at iOS Find Other Nearby Devices (GPS locations), but that would require continually transmitting data to the server to update the user's location using both bandwidth and battery (not to mention the server resources). GPS also seems to take a while to get any sort of accurate fix, and even though I wouldn't store historical data I wouldn't expect users to trust me with that sort of private information (as well they shouldn't!)
I know there are proprietary technologies, such as Sony's NFC, but that's far too narrow a focus to use for an app that I'd like to be device and OS agnostic. What other options are there? Assuming the user is willing to give the app the appropriate permissions, what other methods could allow one device to find another nearby one, within a 10-15 meter range, that is practical for a large (million+) userbase? Is HTML5 Geolocation a better path? Or is GPS my only real option?
I did find Use Android GPS to detect and connect with other phones, but was hoping the past few years have opened up further options.
UPDATE
Thank you for all the responses so far. To answer some questions posed in the comments and answers, I thought I'd describe how I expect the apps/devices to interact.
All users who install this app will have an agent running in the background to update their current geolocation and to listen for pings. Any user may open the full program and send a quick request for all other users nearby. If I go the central server route, then the server responds to that request with a list of nearby usernames. The user can then pick one of those to initiate a connection, in which case the target device makes a sound to notify of a request to connect.
From there it's easy enough to handle the interaction between two devices. Finding those nearby users is the sticking point for me.
Options I can see
Bluetooth (BT). I don't know, if I'm not too skeptical about it, but I see couple of problems. Short range. The biggest energy consumption. Maximum 7 peers connected at the same time (but maybe it's enough...). The big advantage is that a lot of devices support BT.
BT LE (low energy). Ok, it helps energy consumption problem. But, requires Android 4.3.
WiFi Direct (aka P2P). I gave it a shot, I'm a bit disappointed. The problem is that it needs Android 4.0 or higher. Even worse, some devices don't have required hardware. I launched WiFiDirectDemo from Android samples on Samsung Xperia Miro ST23i. Clicked on "search" and the only thing I got was a toast "enable WiFi P2P - in your settings". I clicked on everything in that settings, there is just normal WiFi and other stuff, no mention about Direct or P2P. Xperio Miro just doesn't support WiFi Direct.
WiFi connection with a server through internet + device geolocation. Server keeps positions of users and answers questions like "who is 20 feet in my range?". The problem can be the precision of geolocation. If the walls are thick or you are in a place on earth with few satellites - it can be very inaccurate.
To sum up
There is greater probability that somebody will have WiFi turned on all the time than BT. BT also have some time limits after which it is turned off (they make it this way to probably save battery). So, WiFi seems a better choice than BT.
If WiFi Direct is popular enough for you - I would give it a try. If not, option number 4 seems the best. It's not ideal, I know, but at this point it's hard to come with something better (we still need technology development, WiFi Direct looks promising).
I would use the central server approach. Each phone sends position data to the server. The server notifies the other users when they are in range. To limit used data, only send positions when the device reports movement more then X meters.
Also, consider using a Ping button. The user presses it to send the position when they wish to find someone nearby. Position data would only be sent on this ping. This would use very little power and provide good privacy.
It might be possible to detect details about the connected Wifi access point. If you could get the AP or Gateway's MAC address, you could send that as a kind of position. All the players on the same Gateway would be close by.
I'm happily developing GPS aware apps using LocationManager and NmeaListener, so I am not asking about how to use the Android SDK, but how the Android SDK talks to the internal GPS SDK
I'm trying to understand how Android interacts with the GPS SDK to deliver, for example, the speed and direction values in the GPRMC sentence. Do they come directly from the chip SDK or are they calculatedd by Android?
I'm looking at Android source in LocationManager.java, but I can't find where it interacts with the GPS SDK.
Can anyone point me in the right direction please?
I expect the GPS is a separate sub system which reports data to the system over a serial NMEA connection. If so then the GPS module will calculate Speed (SOG) and Course (COG) using internal methods. For low cost GPS modules they typically have a filtered position difference method. Higher end GPS receivers use carrier phase measurements to get instant results.
I'm guessing that you are noticing a lag in the COG and SOG values and hoping that knowing more about how they are derived will help you correct the lag...
I am trying to test a Location aware application on Android and iPhone in which I need to go to different locations.
Is it possible to mask/change the GPS location of the smart phone in which the GPS app is running using some code in.Net /Java? This is to make testing easier...
Pretty sure something like that would require hacking the onboard GPS chip. The easiest solution here would be to actually have your app mock the GPS coordinates instead.
I use a free 'Fake GPS' application from the Google Play Store for that purpose. I'm sure there are several available on both your target platforms
I'm in the process of starting a new Android project that will:
Display a Google map
Track and record users movements
Display the route on the map
Show local points on interest on the map
My question is what extra tools will I need to accomplish this? I can already get a basic Google Map working with zoom controls and place overlays etc. but my main concern is how I will track the users movements. I was thinking there maybe some sort of fleet management API but I really have no idea.
A link to some sort of tutorial would be great or even just to possible tools.
Use the class http://developer.android.com/reference/android/location/LocationManager.html to obtain the device geographical location
A Caltrans planning grant went towards creating an Android app called CycleTracks that does all of your bulleted items except the last one about points of interest.
You can download the source code here: http://www.sfcta.org/downloads/cycletracks/CycleTracks-android.zip
I haven't looked at the license to see how free you are to use it as a starting point, but I have to imagine it might be helpful just to be able to look at it even if the license is restrictive.
You can read more about it at http://www.sfcta.org/content/view/666/375.
You don't need any extra tools. Use the GPS or radio cells to get the location of the phone. This thread explains how you can get the location:
How do I get the current GPS location programmatically in Android?
If you want to Track the users movement you'll need to run a webservice on a server and have the app report the location of a user at regular intervals.
Be careful though, if you don't tell the user this is what you are doing, and provide an opt out, you could be pulled from the market pretty quickly.
Be sure you aren't recording any sensitive information as well. Usually position, phone type and OS type is allowed but much more could get you in trouble.