What prevent "localNotificationReceived" from working? - Sol

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

What prevent "localNotificationReceived" from working? - Sol

Post by DR White » Fri Dec 30, 2016 11:32 pm

Installed an IOS app to my iPhone 6 with a with a "localNotification" test button. When I pressed the button and closed the LC app, 5 seconds later I would get a notification on my iPhone. It worked the first time and has not worked since (I have been trying all kinds of things, without success for the last 2 - 3 hours). The problem is while I am getting the notifications appearing on the iPhone with the LC app closed and seeing the badge number appear in the LC app icon, when I open the LC app the "On localNotificationReceived" is not activating the answer message. It did work the first time. I have canceled all notifications and set the badge number to zero.

Below is the script for the card:

---------
On localNotificationReceived tMessage
answer "Local Notification:" && quote & tMessage & quote with "Okay"
mobileCancelAllLocalNotifications
iphoneSetNotificationBadgeValue 0
end localNotificationReceived
---------------

Any ideas, what could be wrong?

Thanks,

David
Last edited by DR White on Sat Dec 31, 2016 12:43 pm, edited 1 time in total.

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: What could prevent "localNotificationReceived" from work

Post by DR White » Sat Dec 31, 2016 12:57 am

I also downloaded a LC sample file and I had the same issue of it not responding to the iPhone notifications. See link below:
http://lessons.livecode.com/m/4069/l/58 ... ifications

This post is somewhat a continuation of my previous post "LC Run a program in Mobile environment in the background?". I will quit posting on the previous post.

Thanks,

David

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: What could prevent "localNotificationReceived" from work

Post by DR White » Sat Dec 31, 2016 1:10 am

Attached is my simple test stack.
Please tell me what is wrong with it.

Thank you,

David
Attachments
LocalNotification_Test.livecode.zip
(2.08 KiB) Downloaded 171 times

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: What could prevent "localNotificationReceived" from work

Post by DR White » Sat Dec 31, 2016 12:42 pm

Well, I could not sleep.

Got up early and picked up where I left off with this notification issue.

I started thinking maybe the problem is with my phone, it is amazing what a fresh look at a problem can do.

So I started exploring all aspects of my phone that was related to notifications, I am not a big fan of social media and don't subscribe to anything that sends notifications. Consequently, I don't know anything about how my phone handles them.
I went to settings saw notifications options for several apps, including the one I made with LC. Everything was turned on and I was still experiencing the agony of not having my app work with notifications. I started reading the fine print of each notification option and I discovered that my phone has something called a notification center. So I went there and saw that I had a notification for my LC app.
When I acknowledged the message, I then opened my LC app and Behold I got the dialog box on my LC app with the notification that I had been looking for so painfully long.

So What did I learn:
1. I did not know anything about notifications on my phone
2. While I was seeing badge number on my LC app icon, I don't actually get the notification alert to the LC app untl after I acknowledge the message at my iphone Notification Center.

Let me know, if there are some other things I should be aware of concerning notifications on iPhones and using LC.

Thanks,

David

Post Reply