• This repository has been archived on 11/Feb/2022
  • Stars
    star
    544
  • Rank 78,481 (Top 2 %)
  • Language
    Java
  • License
    Other
  • Created almost 11 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Observes network connection status & gives callbacks

🛑 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

More Repositories

1

android-demos

Examples of Android applications
Java
1,984
star
2

bintray-release

A helper for releasing from gradle up to bintray
Groovy
1,857
star
3

bonfire-firebase-sample

An app to discuss your favourite emojis. This is a sample app built with Firebase.
Java
549
star
4

spikes

Where ideas & concepts are born & incubated
Java
543
star
5

download-manager

A library that handles long-running downloads, handling the network interactions and retrying downloads automatically after failures
Java
487
star
6

gradle-static-analysis-plugin

Easy setup of static analysis tools for Android and Java projects.
Groovy
408
star
7

rxpresso

Easy Espresso UI testing for Android applications using RxJava.
Java
363
star
8

gradle-android-command-plugin

Handy commands for testing Android on CI
Groovy
358
star
9

sqlite-provider

Extended SQLite functionality for Android
Java
303
star
10

no-player

Simplified Player wrapper for MediaPlayer and ExoPlayer
Java
181
star
11

simple-chrome-custom-tabs

Easy integration of Chrome Custom Tabs into your project. Just connect it to your activity, and navigate to the external website styling your tab as you wish.
Java
129
star
12

notils

Never again need a .utils. package yur scurvy sea dogs!
Java
122
star
13

gradle-build-properties-plugin

Keep your secrets secret. External build properties support for your Gradle scripts.
Groovy
112
star
14

ios-demos

Examples of ios applications http://www.novoda.com/blog
Swift
95
star
15

accessibilitools

UI tools to help make your Android app accessible.
Java
81
star
16

dojos

This is where the Novoda team do all their hacking
Java
76
star
17

simple-easy-xml-parser

Simple XML Parsing into Domain Objects
Java
69
star
18

sqlite-analyzer

Code generation for Java/Android database access.
Java
64
star
19

spritz

Spritz is an Android library to seamlessly trigger a Lottie animation
Java
62
star
20

espresso-support

Includes custom rules for testing Views in isolation and running tests with Google TalkBack enabled.
Java
60
star
21

novoda

Common things for all Novoda's open source projects
Java
37
star
22

view-pager-adapter

A simple implementation of PagerAdapter that supports Views.
Java
29
star
23

aosp.changelog.to

Generates a change log between different aosp tags. Based on the wonderful work of @alsutton
HTML
15
star
24

droidcon-booth

Novoda will be showing you CI in action at our Droidcon London booth!
Java
14
star
25

landing-strip

Your simple sliding viewpager tab strip: a landing strip without the fluff!
Java
13
star
26

novoda.github.io

GitHub open source landing page
SCSS
11
star
27

dashboards

The dashboards we have running in our offices!
JavaScript
10
star
28

drop-cap

Custom DropCap view without Spans
Java
10
star
29

public-mvn-repo

Novoda Public Maven Central Repository
7
star
30

github-reports

Github reports for a given organisation
Java
5
star
31

ncu

Novoda Craft University
3
star
32

peepz

Java
3
star
33

eslint-config-novoda

JavaScript
3
star
34

storage-path-finder

Library to perform the heavy lifting when attempting to find internal / external paths for primary and secondary storage.
Java
3
star
35

multiplatform-playground

A repository to play and learn about different multi-platform technologies
TypeScript
2
star
36

dashboard-plugins

A collection of plugins for the dashboard
JavaScript
2
star
37

react-native-workshop

JavaScript
1
star
38

dreams

A REST API using Stable Diffusion for Text to Image inference
Shell
1
star
39

github-slack-action

Simple Github Action to post a message in Slack
Shell
1
star