Skip to content

Conversation

@fbua
Copy link

@fbua fbua commented Aug 5, 2017

Changes proposed in this pull request:

  • Play default notification sound
  • Functionality to attach custom string on notification in order to retrieve it after app is started
    Examples
    Android:
protected override void OnCreate(Bundle bundle)
{   
   [...]
   if (Intent.HasExtra(CrossLocalNotifications.LocalNotificationCustomData))
   {
      var data = Intent.GetStringExtra(CrossLocalNotifications.LocalNotificationCustomData);
   }
}

UWP:

protected override void OnLaunched(LaunchActivatedEventArgs e)
{
   [...]
   if (!string.IsNullOrWhiteSpace(e.Arguments) && e.Arguments.StartsWith(CrossLocalNotifications.LocalNotificationCustomData))
   {
      var data = e.Arguments.Replace(CrossLocalNotifications.LocalNotificationCustomData + "=", string.Empty);
   }
}

iOS:

public override void ReceivedLocalNotification(UIApplication application, UILocalNotification notification)        {
   var key = FromObject(CrossLocalNotifications.LocalNotificationCustomData);
   if (notification.UserInfo != null && notification.UserInfo.ContainsKey(key))
   {
      var data = notification.UserInfo[key].ToString();
   }
}

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
   [...]
   if (options != null && options.ContainsKey(FromObject("UIApplicationLaunchOptionsLocalNotificationKey")))
   {
      var notification = (UILocalNotification)options["UIApplicationLaunchOptionsLocalNotificationKey"];
      ReceivedLocalNotification(app, notification);
   }
}

@karlingen
Copy link

@fbua would you mind fixing the conflicts?

@fbua
Copy link
Author

fbua commented Feb 1, 2019

@fbua would you mind fixing the conflicts?
@karlingen I created this fork for an old project that I don't support anymore

@lavilaso
Copy link

Any news about this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants