Local notifications

Hi, Does the following code need to be included in the build settings for local notifications?

 notification = { iphone = { types = { "badge", "sound", "alert" } } }

The docs lead me to believe this is only needed for push notifications. Is that correct? I am having one minor problem on iOS but everything else is working fine so I’m wondering if this could be the cause of my issue. 

All alerts are happening as expected, but when opening the notifications from the lock screen it crashes and the screen goes black. This has been reported to me by a number of testers, however I can’t recreate the problem on an iOS 6 device or in any of the xCode simulators. It seems to be an iOS 8 device issue. 

Has anybody seen anything like this?

Hi @arlenraisbeck,

Are you using the current Notifications plugin?

Hi, thanks for your response. Yes I changed over to the plugin before I sent it to testers so I can’t say if it was happening before then. It takes a week to be approved in Testflight now so it’s a pain to test small changes. 

I’m scheduling a couple of notifications like this:

secondsFromNow = 10 \* 3600 --(10 hours) options = { alert = mAmount, badge = 0, sound = soundEffect, custom = { num = 5 } } notificationID = notifications.scheduleNotification( secondsFromNow, options ) 

I did not include the badge option in the first version. Could this be the cause? I added it in and am waiting to hear back from testers. Like I say there haven’t been any other issues with alerts.

I appreciate any advice you can offer.

I believe the parts in config.lua are only used by push notifications and not local notifications. When you interact with a push notification from the lock screen it’s going to launch your app it and pass the arguments in via command line processing.  You need something like this:

if launchArgs and launchArgs.notification then     --native.showAlert("launchArgs", json.encode(launchArgs.notification), {"Okay"}) end

in your main.lua. Inside the if statement, you handle your notification.

Rob

Hi @arlenraisbeck,

Are you using the current Notifications plugin?

Hi, thanks for your response. Yes I changed over to the plugin before I sent it to testers so I can’t say if it was happening before then. It takes a week to be approved in Testflight now so it’s a pain to test small changes. 

I’m scheduling a couple of notifications like this:

secondsFromNow = 10 \* 3600 --(10 hours) options = { alert = mAmount, badge = 0, sound = soundEffect, custom = { num = 5 } } notificationID = notifications.scheduleNotification( secondsFromNow, options ) 

I did not include the badge option in the first version. Could this be the cause? I added it in and am waiting to hear back from testers. Like I say there haven’t been any other issues with alerts.

I appreciate any advice you can offer.

I believe the parts in config.lua are only used by push notifications and not local notifications. When you interact with a push notification from the lock screen it’s going to launch your app it and pass the arguments in via command line processing.  You need something like this:

if launchArgs and launchArgs.notification then     --native.showAlert("launchArgs", json.encode(launchArgs.notification), {"Okay"}) end

in your main.lua. Inside the if statement, you handle your notification.

Rob