/android-diagnostics

Diagnose your Android device

Primary LanguageJavaMIT LicenseMIT

An extensible diagnostics activity for Android.

Uses Android's data binding framework, which is still in beta, so expect changes.

Usage

Add this library to your app's build.gradle file:

android {

    // This library uses data binding, so you'll need
    // to add the following lines:
    dataBinding {
        enabled = true
    }
}


dependencies {
    compile 'org.honorato.diagnostics:diagnostics:0.1.7'
}

Create an activity that extends DiagnosticsActivity (remember to declare it on your manifest as well):

public class MyDiagnosticsActivity extends DiagnosticsActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }
}

Call it:

Intent intent = new Intent(this, MyDiagnosticsActivity.class);
startActivity(intent);

Implemented checks

  • RAM Memory
  • GPS enabled
  • Disk space
  • Network connection
  • Network quality (speed)
  • Battery status
  • NTP time sync

Adding custom checks

To add custom checks you'll need to:

  • Create a custom check and override the performCheck method:
public class CustomCheck extends Check {

    public CustomCheck(Context context) {
        super(context);
        setTitle(R.string.custom_title);
    }

    @Override
    public void performCheck() {
        setStatus(STATUS_OK, "Everything's OK!");
    }
}
  • Create an activity that extends DiagnosticsActivity and override setChecks:
public class MyDiagnosticsActivity extends DiagnosticsActivity {

    @Override
    protected void setChecks() {
        super.setChecks();

        // Add your checks like this:
        // this.checks.add(new CustomCheck(this.getBaseContext()));
    }
}

Contributing

Contributions are welcome! Here are a few ideas:

  1. Fix permissions for Android 6.0 (Marshmallow)
  2. Setup a result (to be used along with startActivityForResult)
  3. NetworkQualityCheck needs to be more stable, and provide uplink/downlink checks
  4. Sensor checks are welcome
  5. Create an icon
  6. Coordinator layout for ActionBar + ListView
  7. Add kbps measurement to NetworkQualityCheck