Open michalblaha opened 8 years ago
Right now it loads the activity in launch mode. Yes i am planning to add some code so that you can setup which activity to load, just haven't had the time to figure out the best way to do this.
this is really important, any update on this request?
can you review the pull request I submitted? I've tested this locally and it works as expected for us.
Has this been implemented now? I get the notification to the device and IPushNotificationListener.OnMessage fires with the correct payload.
I'm fairly new to Android so wondering if there's some boilerplate I can hack to respond to notifications being clicked, and directing the user to a custom Notification activity
+1 Any progress on this?
Rendy updated the code a while back that allows the android payload to be accessed, @CR4567: did you grab latest and try it out?
thanx for the quick answer. I'm on version 1.1.7, this should be the recent one, right? Accessing the payload when the message arrives isn't a problem. But I'm trying to handle messages differently after clicking and opening the app. Did I miss this in the documentation? I couldn't find a method that is called after clicking the msg.
apologies, I should have been more specific, yes, the library lets you access the payload once the notification was clicked. The notification should/will fire OnCreate if your app isn't running. In that method, check Intent.Extras. If extras isn't null, there should be a KeySet collection that has the values you can use to handle any downstream decisions about what to load. hth
hm.... weird... you're absolutely right, the onCreate fires when clicking the msg and there is also an Intent.Extras with isEmpty = false.... but I still can't find the values of the notification.
inside OnCreate:
Bundle extras = Intent.Extras;
if (extras != null) {
//YAY, we have message details
foreach (var key in extras.KeySet()) {
System.Diagnostics.Debug.WriteLine(string.Format("MainActivity::Notification::Key:{0}|Value:{1}", key, extras.Get(key)));
}
}
Ah nice. that's working. Thx a lot... couldn't see the content in debug mode but seems to be a debug problem.
after all that time, thinking everything is fine, I found some new and weir behavior... I mixed this code with #39 to receive and react on push notifications even when app is closed. After debugging several times, for me, it looks like the onCreate method is called each time you click on a push. Makes sense and is working usually.... but after I closed the app and clicked the notification it looks like the onCreate is only used once ... when I'm clicking again on a new push only the app starts but without any further processing....
Does that make sense to anyone? Is it using a different service or thread after closing the app?
Is there any update?
Any updates on this? I really need this feature :(
I also need this feature.
Any update?
I need to open a specific screen when I click the notification on Android.
Is it already possible?
I am on version 1.2.4. You can access the message with the method @jmeadecvlt mentioned, I use this inside OnCreate in MainActivity.cs
if(!string.IsNullOrEmpty(Intent.GetStringExtra("message")))
{
//app was started via a push notification
}
Rendy, is any way how to set an Activity which is called after the click on the notification? Or open the main Activity of the app? Or do you plan to add it to the code? (for ex. like here: https://developer.xamarin.com/guides/cross-platform/application_fundamentals/notifications/android/local_notifications_in_android_walkthrough/ )