Saturday, April 16, 2011

CallLoger ;-) Invigilate yourself ;-)

I like Android, it is a dream for programmer :-)

Some time ago I saw presentation prepared by some EU Parliament member who wanted to show how many cell operators know about you.
It was "movie" showing location of this person with information about calls and network usage.

I always knew that cell operators had such data, it is part of technology. Your internet provider also know Mac address of your computer or router. Cell operators know always where is your phone because in case of call they need to route transmission to proper BTS. So your phone login into BTS, or many BTSes (it depends from this which standard it is and so on)... So I wasn't shocked but I wonder "how difficult" will be to do something similar using only phone? ;-)

It looks that it isn't too difficult ;-)

First we need to handle incoming and outcoming calls. To do this we need to register ourselves for receiving some broadcasts: android.intent.action.PHONE_STATE and android.intent.action.NEW_OUTGOING_CALL.
How to do it I found here.

Next we need to create service which will obtain localisation, and will store into file info about time of call, direction (so incoming or outcoming), phone number, localisation (so latitude and longitude), accuracy of location, provider name (so GPS or Network, where Network describes both cell network and WiFi network), and if we will be able also "address". This is easy part, and most tricky thing for me was to wrote it in this way that we first will try to use GPS, and if we will not have location from GPS in 5 seconds we will try to use Network.

Last part is code for displaying results of our autoinvigilation ;-)

Here results on my Nexus S :-)

Here sample with result from Network (WiFi):

How you can see we have here rather good accuracy, about 60 meters (radius of circle shows accuracy). Btw. it is near KRK Google office ;-)

Here you can see more "global" ;-) view. Little circle near upper left corner is this what you saw on picture above:

Here how looks my all connections to now, from the right you can see Kraków and my connections in Kraków (those you can see on pictures above):

And now how it looks when almost only GSM network is used ;-)

If you are interesting in seeing the code, you can find it here.
If you want APK file, you may find it here.

Isn't it cool that you can write something like this in less than 300-400 lines? :-)

Similar postsbeta
Calculation of SSD life time in EEE PC
Chrome2Chrome - lets move browser tabs between computers ;-)
OOo2GD - surveys results
How to detect clickbaits?
What sux in G1?

No comments:

Post a Comment