An ok name for a library.
Merlin aims to simplify network monitoring. Providing 3 registerable callbacks for network connectivity changes.
onConnect()
, onDisconnect()
and onBind(NetworkStatus networkStatus)
.
To start using this library, add these lines to the build.gradle
of your project:
repositories {
jcenter()
}
dependencies {
compile 'com.novoda:merlin:0.8.0'
}
Create Merlin:
merlin = new Merlin.Builder().withConnectableCallbacks().build(context);
Bind and unbind the service in your activity:
@Override
protected void onResume() {
super.onResume();
merlin.bind();
}
@Override
protected void onPause() {
merlin.unbind();
super.onPause();
}
Register for callbacks:
merlin.registerConnectable(new Connectable() {
@Override
public void onConnect() {
// Do something you haz internet!
}
});
Also check the wiki to see how you can use MerlinsBeard
to check the network state.
Here are a list of useful links:
- We always welcome people to contribute new features or bug fixes, here is how
- If you have a problem check the Issues Page first to see if we are working on it
- For further usage or to delve more deeply checkout the Project Wiki
- Looking for community help, browse the already asked Stack Overflow Questions or use the tag:
support-merlin
when posting a new question