|
1 | | -# EasyNotifyLibProject |
2 | | -Send firebase notifications to your users very easily: A new Android Lib |
| 1 | +# EasyNotify |
| 2 | +An Android Library to send Firebase notifications to users easily. |
| 3 | + |
| 4 | +# Demo |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +# Download |
| 9 | + |
| 10 | +* Step 1. Add it in your root build.gradle at the end of repositories: |
| 11 | +```java |
| 12 | + allprojects { |
| 13 | + repositories { |
| 14 | + ... |
| 15 | + maven { url 'https://jitpack.io' } |
| 16 | + } |
| 17 | + } |
| 18 | +``` |
| 19 | +* Step 2. Add the dependency |
| 20 | +```java |
| 21 | + dependencies { |
| 22 | + compile 'com.github.iammannan:EasyNotifyLibProject:1.0' |
| 23 | + } |
| 24 | +``` |
| 25 | + |
| 26 | +# EasyNotify |
| 27 | +* Initialize |
| 28 | +```java |
| 29 | + EasyNotify easyNotify = new EasyNotify("YOUR_APP_API_KEY"); |
| 30 | +``` |
| 31 | +* Send by TOPIC or TOKEN |
| 32 | +```java |
| 33 | + easyNotify.setSendBy(EasyNotify.TOPIC); |
| 34 | + easyNotify.setSendBy(EasyNotify.TOKEN); |
| 35 | +``` |
| 36 | + * IF Send by TOPIC |
| 37 | + ```java |
| 38 | + easyNotify.setTopic("YOUR_TOPIC"); |
| 39 | + ``` |
| 40 | + * IF Send by TOKEN |
| 41 | + ```java |
| 42 | + easyNotify.setToken("YOUR_FIREBASE_TOKEN"); |
| 43 | + ``` |
| 44 | + * IF Send by TOKEN |
| 45 | + ```java |
| 46 | + easyNotify.setToken("YOUR_FIREBASE_TOKEN"); |
| 47 | + ``` |
| 48 | + * Notification Optional Parameters |
| 49 | + ```java |
| 50 | + easyNotify.setTitle("YOUR_TITLE_STRING"); |
| 51 | + easyNotify.setBody("YOUR_BODY_STRING"); |
| 52 | + easyNotify.setClickAction("YOUR_CLICK_ACTION"); |
| 53 | + easyNotify.setSound("default"); |
| 54 | + ``` |
| 55 | + * Push your Notificaton to Firebase server |
| 56 | + ```java |
| 57 | + easyNotify.nPush(); |
| 58 | + ``` |
| 59 | + * Set EasyNotify Listener, Check your push request success or not. |
| 60 | + ```java |
| 61 | + easyNotify.setEasyNotifyListener(new EasyNotify.EasyNotifyListener() { |
| 62 | + @Override |
| 63 | + public void onNotifySuccess(String s) { |
| 64 | + Toast.makeText(MainActivity.this, s, Toast.LENGTH_SHORT).show(); |
| 65 | + } |
| 66 | + |
| 67 | + @Override |
| 68 | + public void onNotifyError(String s) { |
| 69 | + Toast.makeText(MainActivity.this, s, Toast.LENGTH_SHORT).show(); |
| 70 | + } |
| 71 | + |
| 72 | + }); |
| 73 | + ``` |
3 | 74 |
|
4 | | -my first android library...yeahooooooO |
5 | 75 |
|
6 | | -Sample Code: |
7 | | -https://scontent-sin6-1.xx.fbcdn.net/v/t1.0-9/25353885_1971693823055397_4602941308793206484_n.jpg?oh=242f11e0c4e7fd977147cebff95697e8&oe=5A89CAAA |
|
0 commit comments