Android App Performance Monitoring Tool Set. Disappointed by the lack of good ping apis in android, I developed Java Ping Tool that call ping native interface by jni for everyday android development.
- support all ping commands
This library is released in Maven Central
then add a library dependency.Remember to check for latest release here
dependencies {
implementation 'io.github.peakerbee:ping:0.0.4'
}
Requires internet permission (obviously...)
<uses-permission android:name="android.permission.INTERNET" />
Only Support IPV4
Ping ping = Ping.onAddress("baidu.com");
ping.setTimes(5);
new Thread(() -> ping.startPing(new Ping.Callback() {
@Override
public void onEnter(String msg) {
Log.i(TAG, "onEnter: " + msg);
}
@Override
public void onStart(String msg) {
Log.i(TAG, "onStart: " + msg);
}
@Override
public void onResult(PingResult res) {
Log.i(TAG, "onResult: " + res);
}
@Override
public void onError(String msg) {
Log.i(TAG, "onError: " + msg);
}
@Override
public void onStatistics(PingStatistics statistics) {
Log.i(TAG, "onStatistics: " + statistics);
}
@Override
public void onEnd(String msg) {
Log.i(TAG, "onEnd: " + msg);
}
})).start();
It's a standard gradle project.
I welcome pull requests, issues and feedback.
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Added some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
- traceRoute Tool