Tracking device’s Cell Location Change in Android

In wireless telephony, a cell is the geographical area covered by a cellular telephone transmitter.

A mobile devices keeps changing its Cell in order to stay connected to the network provider. That is how you get uninterrupted network access wherever you go. Using PhoneStateListener class in Android, we can determine if user’s device switches Cell Tower.

[From official docs] PhoneStateListener is a listener class for monitoring changes in specific telephony states on the device, including service state, signal strength, message waiting indicator (voicemail), and others.

Note that access to some telephony information is permission-protected. Your application won’t receive updates for protected information unless it has the appropriate permissions declared in its manifest file.

  • Since detecting cell location change in Android requires some Location Tracking, add the following permission in your manifest : <uses-permission android:name=”android.permission.ACCESS_COARSE_LOCATION” />.
  • Create a class that extends PhoneStateListener and override the onCellLocationChanged method :

cell_location_changed

  • Get Android’s Telephony Manager System Service and set up a listener for getting Cell Tower Location changes. Pass it an object of the class extending PhoneStateListener that you created earlier.

Telephony Manager

  • Now, you’ll receive and CellLocation object whenever the user’s device switches Cell Tower. Using this object you can request a location update by calling requestLocationUpdate().

1 thought on “Tracking device’s Cell Location Change in Android

  1. Although an Android program can be made accessible by developers through their sites,
    most Android programs are uploaded and published on the Android Market,
    an online store dedicated to these applications. The Android Market features both free and expensive programs.

    Android programs are written in the Java programming language and use Java core libraries.
    They are first compiled to Dalvik executables to run on the Dalvik virtual machine, which will be a
    virtual machine especially created for mobile devices.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s