1

Read and Direct replay through notifications pragmatically from my android app, Is it possible?. Currently its possible to send reply through notification-bar in android manually. For example the whats-app/hike message can be read and replay through the notification bar without opening the app. I think its possible to do with a code that works for wearable devices. If anyone know about it please help me.

here is the example code to read notification.

    package learn2crack.notification;

    import android.content.Context;
    import android.content.Intent;
    import android.os.Bundle;
    import android.service.notification.NotificationListenerService;
    import android.service.notification.StatusBarNotification;
    import android.util.Log;
    import android.support.v4.content.LocalBroadcastManager;


    public class NotificationService extends NotificationListenerService {

        Context context;

        @Override

        public void onCreate() {

            super.onCreate();
            context = getApplicationContext();

        }
        @Override

        public void onNotificationPosted(StatusBarNotification sbn) {


            String pack = sbn.getPackageName();
            String ticker = sbn.getNotification().tickerText.toString();
            Bundle extras = sbn.getNotification().extras;
            String title = extras.getString("android.title");
            String text = extras.getCharSequence("android.text").toString();

            Log.i("Package",pack);
            Log.i("Ticker",ticker);
            Log.i("Title",title);
            Log.i("Text",text);

            Intent msgrcv = new Intent("Msg");
            msgrcv.putExtra("package", pack);
            msgrcv.putExtra("ticker", ticker);
            msgrcv.putExtra("title", title);
            msgrcv.putExtra("text", text);

            LocalBroadcastManager.getInstance(context).sendBroadcast(msgrcv);


        }

        @Override

        public void onNotificationRemoved(StatusBarNotification sbn) {
            Log.i("Msg","Notification Removed");

        }
    }

here is the code for reading all notifications using code. Please help me to do the same for send replay.

PRAJIN PRAKASH
  • 1,366
  • 1
  • 15
  • 31
  • this might help you [notification-with-reply-action](https://developer.android.com/training/notify-user/build-notification#reply-action) – AgentP Aug 30 '19 at 12:53
  • from reading this, Its help us to create a notification that is capable of receiving replay from user inputs to our app,I don't want to implement quick replay notification. I want read other apps notification and quick replay to that from my app. – PRAJIN PRAKASH Aug 30 '19 at 13:12

0 Answers0