localnotificationsplugin
localnotificationsplugin copied to clipboard
Added custom data and default sound in local notifications
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);
}
}
@fbua would you mind fixing the conflicts?
@fbua would you mind fixing the conflicts? @karlingen I created this fork for an old project that I don't support anymore
Any news about this ?