Pass pushy notification message

bageegbageeg SDMember ✭✭

Hello, I am using pushy to get notifications in my App, I want to pass the message data to another activity and display in textview, how to do that.

public override void OnReceive(Context context, Intent intent)
    {
        // Default notification title/text
        string notificationTitle = "Pushy";
        string notificationText = "Test notification";

        // Attempt to extract the "message" property from the payload: {"message":"Hello World!"}
        if (intent.GetStringExtra("message") != null)
        {
            notificationText = intent.GetStringExtra("message");
        }

        // Prepare a notification with vibration, sound and lights
        var builder = new NotificationCompat.Builder(context)
              .SetSmallIcon(Android.Resource.Drawable.IcDialogInfo)
              .SetContentTitle(notificationTitle)
              .SetContentText(notificationText)
              .SetLights(Color.Red, 1000, 1000)
              .SetVibrate(new long[] { 0, 400, 250, 400 })
              .SetSound(RingtoneManager.GetDefaultUri(RingtoneType.Notification))
              .SetContentIntent(PendingIntent.GetActivity(context, 0, new Intent(context, typeof(MainActivity)), PendingIntentFlags.UpdateCurrent));

        // Get an instance of the NotificationManager service
        var notificationManager = (NotificationManager)context.GetSystemService(Context.NotificationService);

        // Build the notification and display it
        notificationManager.Notify(1, builder.Build());

    }
Sign In or Register to comment.