GitHub Issues Apache License 2.0 Bintray app-debug.apk (v0.2 stable)




group Discord chat Telegram

All Projects

Signal Strengths

git:// Watch  Star  Fork

SignalStrengths is a library and sample application with the purpose of getting an accurate signal strength on different Android phones.

For testing and experimentation purposes, a sample apk can be downloaded here.



The Gradle dependency is available through jCenter, which is used by default in Android Studio. To add the module to your project, copy this line into the dependencies section of your build.gradle file.

compile 'james.signalstrengths:signalstrengths:0.0.4'

Listening for Signal Changes

To get your app to listen for a signal change, use TelephonyManager.listen with a PhoneStateListener. A working example of this can be seen in the sample application.

Getting a Signal Value

To obtain a signal value from a SignalStrength object, simply pass it to one of the methods in the SignalStrengths class, which will return a number from 0-4, or -1 if an error occurs. Some examples of this are below.

Using a Specific Method

This allows you to specify exactly which method you want to obtain a value from.

double level = SignalStrengths.get(SignalStrengths.METHOD_LEVEL, signalStrength);

First Valid Level

This gets the first valid signal level available from any method in order of accuracy. This is the most recommended way of getting a signal value, as it is the most consistently accurate across different phones and android versions. See Excluding Methods and Custom Methods for ways to change this method’s behavior.

double level = SignalStrengths.getFirstValid(signalStrength);

Average Level

This gets the average of all the valid levels. To exclude a level, see Excluding Methods.

double level = SignalStrengths.getAverage(signalStrength);

Excluding Methods

The list of methods used by SignalStrengths can be accessed using SignalStrengths.getMethods(). An example of how to exclude a method is below.


Custom Methods

It is also possible to add your own method to the list of methods used by SignalStrengths. An example for how to create a new method is below.

SignalStrengths.getMethods().add(new SignalMethod("Method Id") {
  public double getLevel(SignalStrength signalStrength) {
    return new Random().nextDouble();

Last updated: