|
| 1 | +# android-remote-notifications |
| 2 | +An Google GCM/Amazon SNS alternative |
| 3 | +## Main features |
| 4 | +- Independent user notifications (no Google GCM or Amazon SNS), just put a JSON file in the cloud |
| 5 | +- Framework will update available notifications automatically in defined time intervals (`now`, `daily`, `weekly`, `monthly`) |
| 6 | +- Flexible parameters: |
| 7 | + - start date for notification (distribute early, show later) |
| 8 | + - amount of times the notification should be shown |
| 9 | + - interval between showing notifications (`always`, `every day`, `every week`, `every month`) |
| 10 | + - specify on which app version (`versionCode`) the notification should be shown |
| 11 | +- Show notifications as `AlertDialog` or `Toast` message (defined by the remote JSON file) |
| 12 | + - `AlertDialog`: Specify button captions and actions: `Open Store`-Action, `Open URL`-Action, `Exit App`-Action, all defined by a JSON file on your server |
| 13 | +- perfect to inform your users about discounts on one of your other apps or premium version |
| 14 | +- pro tip: as some users don't always update to the latest app versions you should integrate this framework in an early phase if you plan to use it at a later time. |
| 15 | + |
| 16 | +## How to integrate |
| 17 | +### The easy way |
| 18 | +- Call `RemoteNotifications.start(context, url, UpdatePolicy.NOW);` in your `onCreate()` or `onResume()` method |
| 19 | + |
| 20 | +this will |
| 21 | +- start an update of the notifications (use `UpdatePolicy.WEEKLY` in production environment to update once a week) |
| 22 | +- show due notifications to the user |
| 23 | + |
| 24 | +### If you want more control |
| 25 | +```java |
| 26 | +RemoteNotifications rn = new RemoteNotifications(context); |
| 27 | +rn.updateNotifications(UpdatePolicy.NOW); |
| 28 | +rn.showNotifications(); // if update still runs, event will be queued and carried out later |
| 29 | + |
| 30 | +// -or, register a listener on update completion- |
| 31 | +rn.updateNotifications(UpdatePolicy.NOW, finishListener); |
| 32 | +``` |
| 33 | + |
| 34 | +## Demo |
| 35 | +### App |
| 36 | +[Download](https://drive.google.com/uc?export=download&id=0B0qVR-zttDRCeXo0SF9RMVhZZHM) |
| 37 | +### Source |
| 38 | +[MainActivity](https://github.com/kaiwinter/android-remote-notifications/blob/master/example/src/main/java/com/github/kaiwinter/androidremotenotifications/example/MainActivity.java) |
| 39 | + |
| 40 | +## Screenshots |
| 41 | + |
0 commit comments