Home
Softono
EasyNotifyLibProject

EasyNotifyLibProject

Open source Java
32
Stars
19
Forks
1
Issues
2
Watchers
4 years
Last Commit

About EasyNotifyLibProject

Send firebase notifications to your users very easily: A new Android Lib

Platforms

Web Self-hosted Android

Languages

Java

Links

EasyNotify

An Android Library to send Firebase notifications to users easily.

Demo

With empty EditText Completed all EditText Final Result Demo Video

Download

  • Step 1. Add it in your root build.gradle at the end of repositories:
      allprojects {
          repositories {
            ...
            maven { url 'https://jitpack.io' }
          }
      }
  • Step 2. Add the dependency
      dependencies {
              compile 'com.github.iammannan:EasyNotifyLibProject:1.2'
      }

EasyNotify

  • Initialize

      EasyNotify easyNotify = new EasyNotify("YOUR_APP_API_KEY");
  • Send by TOPIC or TOKEN

     easyNotify.setSendBy(EasyNotify.TOPIC);
     or
     easyNotify.setSendBy(EasyNotify.TOKEN);
  • IF Send by TOPIC

      easyNotify.setTopic("YOUR_TOPIC");
  • IF Send by TOKEN

      easyNotify.setToken("YOUR_FIREBASE_TOKEN");
  • Notification Optional Parameters

         easyNotify.setTitle("YOUR_TITLE_STRING");
         easyNotify.setBody("YOUR_BODY_STRING");
         easyNotify.setClickAction("YOUR_CLICK_ACTION");
         easyNotify.setSound("default");
  • Push your Notificaton to Firebase server

      easyNotify.nPush();
  • Set EasyNotify Listener, Check your push request success or not.

    easyNotify.setEasyNotifyListener(new EasyNotify.EasyNotifyListener() {
             @Override
             public void onNotifySuccess(String s) {
                 Toast.makeText(MainActivity.this, s, Toast.LENGTH_SHORT).show();
             }
    
             @Override
             public void onNotifyError(String s) {
                 Toast.makeText(MainActivity.this, s, Toast.LENGTH_SHORT).show();
             }
    
         });
  • Full Code - Example

        EasyNotify easyNotify = new EasyNotify(api_key.getText().toString());
        easyNotify.setSendBy(EasyNotify.TOPIC);
        easyNotify.setTopic(topic.getText().toString());
        easyNotify.setTitle(title.getText().toString());
        easyNotify.setBody(body.getText().toString());
        easyNotify.setClickAction(click_action.getText().toString());
        easyNotify.setSound(sound.getText().toString());
        easyNotify.nPush();
        easyNotify.setEasyNotifyListener(new EasyNotify.EasyNotifyListener() {
            @Override
            public void onNotifySuccess(String s) {
                Toast.makeText(MainActivity.this, s, Toast.LENGTH_SHORT).show();
            }
    
            @Override
            public void onNotifyError(String s) {
                Toast.makeText(MainActivity.this, s, Toast.LENGTH_SHORT).show();
            }
    
        });