How can I track my android device from a remote server? - android

I'm willing to create a personal system, which would keep track of my phone's location every ~5 minutes, and display it on a map on a website.
I'm trying to achieve this by having an (official) Google API that would let me know the location of my phone. (actually, 4 phones, which I would gather data for each of them)
I tried searching on what's existing, but I couldn't find anything, apart from stuff of 2013 that is no longer available.
Is there, to this day, any mean to achieve that, or do I need to create an application which would send data to a server from the phone?

Related

Google Nearby Connections api vs Nearby Messages api, benefits/limitations

I'm starting to think about a near by group chat application in Android with the following prerequisites:
Have to be able to connect groups of users up to 250 without too much problems.
The messages sent by the users will be public and all the group members have to receive them.
The message will be the combination of a tiny profile image (no more than 20KB), a user identifier and a text message up to 250 characters.
The range of the messages should be around 100 meters (~300ft)
These are the base requirements, there are other ones that are also related to the way of connect but I want to keep it clear and simply by now.
I tried to look for information of both apis but I'm still doubitative about them.
I know that the connections api has a mesh P2P_CLUSTER strategy that probably could fit but I don't have information about other things such as stability, real distance and maximum number of users.
On the other hand, the messages api seems more suitable but It needs a permanent internet connection, which is something still in consideration for the moment.

How to retrieve activities from Garmin Fenix3

I'd like to automatically import my activities from my Garmin Fenix3 into a database (without the need to manually download the TCX files). Two options came to my mind to solve this task:
A Server based app which gets connected to the Garmin Connect API and is notified (via RESTful APIs) by GarminConnect each time an activity has been uploaded - is my understanding correct, that I need for this use case the $5,000 expensive Garmin API licence?? http://developer.garmin.com/garmin-connect-api/overview/
Create an Android App which gets notified by the installed Garmin Android Connect App each time a new activity has been created - how can I achieve this? From my understanding, the Connect IQ Mobile SDK For Android can be used to create an Android App which interacts with your own application on the Garmin Device itself (which is not needed for my scenario, I just want to automatically "download" the activities created by the default Fenix3 apps).
Any help is highly appreciated - thanks.
I can answer now my own question. It is NOT possible to access the recorded data automatically unless you pay the $5,000 for the Garmin API licence (this is soooo ridiculous Garmin!!!). The Connect IQ Mobile SDK approach will NOT do this job, confirmed by the Garmin Support Team.
The only way to get your data is by manually downloading the FIT or TCX file from https://connect.garmin.com . Keep in mind though that the Running Dynamics (which are captured and calculated by the HRM-Run sensor) are NOT included in these files!
Vertical Oscillation
Vertical Ratio
Left/Right Balance
Avg Ground Contact Time
Training Effect
This is a very big disappointment Garmin! In which century are you guys still living? The data generated by the user belongs to the user and it should be easy accessible! Keeping the data locked in your safe will not really attract more users to the connect platform... But time will tell.

Best back-end choice for GPS-tracking application

I'm about to create a GPS-tracking application for pizza-delivery services in my city, so that when someone orders pizza over the phone or Internet, he can see the courier that carries pizza to him on the map.
Assuming that both courier and client use Android- or iOS-based phone for transmitting/receiving current position, how can I organize a reliable connection between them? Should the courier's phone send his coordinates to my server via HTTP every 5 seconds for delivering it to client, or it will be better to set up something like p2p connection?
I don't know where to start, please help. Thank you very much.
There are open source solutions for GPS tracking. You can start from there instead of developing everything from scratch.
Traccar server (back-end for receiving location data from various devices):
https://github.com/tananaev/traccar
There are also apps for Android and iOS, but only for transmitting location data:
https://github.com/tananaev/traccar-client-android
https://github.com/tananaev/traccar-client-ios
I don't think p2p will be a good solution.
Most of the application use web services and make server calls after a definite interval of time like 10 seconds or 15 seconds refresh to get updated data on both side of apps(Client and courier).
If you want to build a real time application like other real time apps then you need to implement sockets on web and on mobile apps.
But I think in your case web services would be good enough solution.

How to detect the cause for HUGE data usage when my app in background

We have an Android app with over a million active users. We recently started receiving feedbacks from users complaining that our app consumes huge amount of network data when in background (around 0.5-3 gigabytes in a week).
The app doesn't have any operations in the background except for the push notifications receiver which doesn't have any network calls. the data consumption on the background should be less than 10 megabytes for a week for sure.
Is there a code I can use to help me detect the cause for this data consumption when my app is in background?
Is there a way to limit data access from all SDKs when my app is in background?
In general, what's the best way to approach such a problem?
Thanks
Update:
In our case we found eventually that the source of the problem was from an SDK we integrated with the app.
If you have the same issue, I suggest you look closely at all your 3rd party code in the app, especially new libraries you added.
Second, check all the services that your app define in the manifest, look closely if any of those services can be the source for this problem.
Third, look for places in the app that use network operation with a re-try mechanism, there could be an infinite "while loop" trying to send some data to a server (maybe some sort of reporting or analytics).
You need to inspect the traffic coming over the wire from your devices. You will need one computer and your device connected to the same local network.
Set up a debugging proxy like Fiddler on a machine on your local network and note its IP address. This assumes your app communicates via HTTP.
Connect your test device(s) via WiFi to the same network as your debugging machine.
Configure your Android devices to use a proxy that points to your debugging machine.
Now you will be able to inspect all requests originating from the device(s). Presumably you will have to leave them running for some time to replicate the problem of some kind of periodic background service running and downloading data. However, I can tell you now that push notifications themselves are not causing 3GB of data on a single device.
You can write code for count the data usage as follows.
recived = TrafficStats.getUidRxBytes(uid);// uid is your appID
send = TrafficStats.getUidTxBytes(uid);
TrafficStats.getMobileRxBytes();
TrafficStats.getMobileTxBytes();
TrafficStats.getTotalRxBytes();
TrafficStats.getTotalTxBytes();
and there is good answer you can find here..
App data usage finding

Use Android GPS to detect and connect with other phones

So I asked something similar yesterday and did receive an answer to my question, however I don't really think I asked it correctly and therefore didn't receive the exact information I needed.
I'm in search of an API, some open source code, or even just a way that someone else has achieved this on the Android. I'm making an app that needs to find all other Android devices within a specified radius. For example, when you open your Android Google Maps App, and you search for say "Restaurants [ZipCode]", it uses a radius modified from your zip code and finds all of those places. The GPS gets YOUR location, and maps uses that information to find restaurants within an address close to that passed in location.
Instead, I want to be able to use the GPS to find my location (as it can now easily), but instead of finding things on a map (which is already built in), I want to be able to find other GPS enabled Android phones. I get that they will have to be broadcasting their GPS signal at the same time as well (since they don't have their data stored with some sort of central database as a restaurant would). However, I don't just want to FIND these phones, I want to send/receive data from these phones (with correct permissions obviously).
Now, I've found things like the Bump API. However, BUMP uses the phones sensors to spark this search. So basically, if you "bump" your phone with another and have the app running, it will THEN go ahead and use GPS to find the location of the other phone you just bumped with and exchange data between them. This is like EXACTLY what I want to do however in their API, they do not provide the functionality to just say, "Hey, give me all phones within a mile from me."
I've also found API's that can do exactly what I need but they have to be on the same Bluetooth range or on the same Wi-Fi network, which doesn't suit what I need at all.
Do you guys know of anything that can fit exactly what I need that already exists? Or a way to maybe modify Bump API (if you've done it), to not have to use the phone sensors and find phone information directly through GPS for phones around you? Or is there something that exists over a 3g/4g network instead of only wi-fi/Bluetooth?
Thanks guys.
Instead of frequently posting locations to an external server, couldn't the GPS realize other things broadcasting a GPS signal at a very specific time and send/receive data from them?
The only things that are "broadcasting a GPS signal" are satellites.
We would like to accomplish this without the use of an external server.
You have no choice but to use an external server, whether you like it or not, both for discovery and for later communication.
Do you guys know of anything that can fit exactly what I need that already exists?
Foursquare, Google Latitude, Yahoo Fire Eagle, and so on.
To do this via GPS, you would have to have all the phones frequently posting their locations to a network server, which could then inform them of others nearby.
Needless to say this would be opt-in only!
And it may have negative consequences for battery life, unless you make it update infrequently, which may limit its usability.
The advantage of having an explicit trigger action to both phones is that they only need to query the GPS and inform the server to find each other by location when they've both been triggered.
You would probably have to author your own application - then you could do this server-side and push things. If you're trying to push data to random Android phones - you're out of luck. Most people aren't going to want this, and probably aren't going to have the apps necessary to receive and understand it. With Bluetooth networking you'd need authorization, and most Androids don't have a capability to transfer random data by Bluetooth out of the box (though you certainly can get software to do it).
Honestly, malware and tracking are the reasons this really isn't possible, but even if they weren't, you would still need an application on the receiving devices that understand what you're sending them. And if you're widely spread enough, you'd probably want to send it to a server to disseminate anyway (for the transmitting phones bandwidth costs at least).
Develop a server application that your android app logs into. Send the GPS location every time the phone moves over a present distance. Either send a query request to the server to ask it if any other phones are in range, or get the server to inform the phone of a new device in range.
You may run into server scalability problems, so thats something to think about.
Also, this would be a big battery drain, and so your users may not be too keen to run it, not to mention the privacy element.
You need to rethink what you're trying to do. Android devices don't "transmit" any GPS signal, they are simply receivers, with signals from satellites. So the phone can easily get a location for itself, but the location of other devices is very, very private information. To get access to location for other phones, you either need to be on the same network as them (bluetooth, wifi), or you need them to use a server-based service to send locations to, like Google Latitude.
I'd be highly unlikely to sign up to a service like that. My location is very private, I share it with some people, but I cannot seem myself openly sharing it with an app, without a very, very good reason.
It seems to me that you need to build a server-based application, e.g. on Google App Engine, have people sign up, and agree to their location being sent to that server, so other phones running your app can access that information from the central store.
The question now has a very simple solution to it. All you have to do is set up a Geofence and monitor it for entry and exit of users. Geofence allows you to choose a geolocation and set a circle of desired radius around it. When someone enters or exits the location you can get notified and perform desired action.
Visit this link for further details on how to use this in Android.
All the comments from other folks about not being able to pick up the signal from others phones are correct. There is a completely different alternative system however in the network based location services. This is a model where you ask a carrier network for the location of a handset, which the carrier network needs to track for enhanced 911 service in the US (I'm unaware of how widely deployed this is in other areas, and how many different services you would need to use to cover other areas).
It's potentially a very expensive route however. And it won't just automatically work for all handsets, I believe the users will have to be opted into sharing location with your service. This is how services like Loopt had initially setup their location info so that it could be passively collected without negatively impacting handset battery life. There are some third party services that front for a cross-carrier service such as Location Labs:
http://locationlabs.com/
As well as third party location services like Skyhook Wireless, who might be able to get you some info of the sort (though I don't think what you're looking for maps to any of their existing APIs)

Categories

Resources