Git Product home page Git Product logo

merlin's Introduction

๐Ÿ›‘ THIS REPOSITORY IS OFFICIALLY NO LONGER UNDER MAINTENANCE since 10/02/2022 ๐Ÿ›‘

Merlin header image

Merlin Build status Download License

Merlin aims to simplify network monitoring. Providing 3 registerable callbacks for network connectivity changes. onConnect() , onDisconnect() and onBind(NetworkStatus networkStatus).

Adding to your project

To start using Merlin, add these lines to your module's build.gradle:

repositories {
    jcenter()
}

dependencies {
    implementation 'com.novoda:merlin:1.2.0'
}

Optional steps

Note: these steps should not be necessary as the Manifest Merger should be taking care of this for you!

If for some reason your app's manifest doesn't end up containing the required entries, and you encounter issues, you might need to manually add a few things to your AndroidManifest.xml:

  1. These permissions:

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  2. This service:

    <service
      android:exported="false"
      android:name="com.novoda.merlin.MerlinService" />

Sample usage

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!
    }
});

For further details you can check the wiki.

Migrating from pre-v1 versions

Version 1 of Merlin introduced several breaking changes in the implementation and the APIs, to account for the latest changes in Android N+. Please follow the instructions in the wiki to make the upgrade as painless as possible.

Migrating from 1.1.7

In version 1.1.8 some public API changes were made. According to our tests auto importing should be able to take care of these changes.

RxJava support in v1.0+

Starting in version 1.0.0, the RxJava support is no longer built into the library but it has been split out into a separate artifact. You'll need to add one of these two dependencies, depending on the version of RxJava you use:

// For RxJava 1.x
implementation 'com.novoda:merlin-rxjava:[version_number]'

// For RxJava 2.x
implementation 'com.novoda:merlin-rxjava2:[version_number]'

Links

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

merlin's People

Contributors

amlcurran avatar anupcowkur avatar arturdryomov avatar ataulm avatar blundell avatar caroinberlin avatar charroch avatar danybony avatar electryc avatar fourlastor avatar frapontillo avatar friedger avatar hcmsilva avatar hutch4 avatar jd-alexander avatar joetimmins avatar jszmltr avatar juankysoriano avatar krishan711 avatar mr-archano avatar niltsiar avatar ouchadam avatar rock3r avatar ronocod avatar tagantroy avatar takecare avatar tasomaniac avatar xrigau avatar zegnus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.