Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: iOS notifications not working as advertised


This question is not answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 5 - Last Post: Sep 11, 2017 7:06 PM Last Post By: Dave Nottage
aneal chandra

Posts: 6
Registered: 4/15/01
iOS notifications not working as advertised  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 11, 2017 2:31 PM
Hi All,
iOS notifications are not working in iOS10 32/64 bit with Berlin or Tokyo. According to
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Mobile_Tutorial:_Using_Notifications_(iOS_and_Android)
it should be a couple of clicks and a few lines of code but I can't make it work, although it works on Android.

Please try and vote for the bug

https://quality.embarcadero.com/browse/RSP-17939

Note that it is currently assigned a priority of 'major' which AFAIK means there is a workaround.
Can anyone post some code detailing how to make this core functionality work in iOS?

Thanks
Aneal
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: iOS notifications not working as advertised
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 11, 2017 2:48 PM   in response to: aneal chandra in response to: aneal chandra
aneal chandra wrote:

iOS notifications are not working in iOS10 32/64 bit with Berlin or Tokyo. According to
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Mobile_Tutorial:_Using_Notifications_(iOS_and_Android)
it should be a couple of clicks and a few lines of code but I can't make it work, although it works on Android.

Please try and vote for the bug

https://quality.embarcadero.com/browse/RSP-17939

Note that it is currently assigned a priority of 'major' which AFAIK means there is a workaround.
Can anyone post some code detailing how to make this core functionality work in iOS?

Note also that the report refers to push notifications (not notifications in general), and also appears to be a
problem on iOS 10 only. (Check the comments). See also:

https://quality.embarcadero.com/browse/RSP-16762

Contrary to the description in the above report, iOS notifications have no concept of priority (they do on Android).
There's also a distinct lack of exact steps/scenarios, because notifications work for me on iOS 10 as per Apple's specs
i.e. on iOS 10 they will not show if the application is the active one, and the device is unlocked:

https://developer.apple.com/documentation/uikit/uilocalnotification

"If the app is foremost and visible when the system delivers the notification, the app delegate’s
application(_:didReceive:)
is called to process the notification. Use the information in the provided UILocalNotification object to decide what
action to take. *The system does not display any alerts, badge the app’s icon, or play any sounds when the app is
already frontmost.*"

Note the last sentence.

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
aneal chandra

Posts: 6
Registered: 4/15/01
Re: iOS notifications not working as advertised  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 11, 2017 4:19 PM   in response to: Dave Nottage in response to: Dave Nottage
Hi Dave,
My mistake. Thank you for posting the correct ticket
https://quality.embarcadero.com/browse/RSP-16762

Note that my reference to priority in my previous post referred to JIRA priority as I do not understand why how Embarcadero decide the priority to assign to a ticket. It is also not clear to me why this ticket is still open, as it should be marked invalid and closed if it is indeed incorrect.

Anyway, back to the point - i.e. how to make the PresentNotification actually show a notification in iOS10. From what you have written it seems to me that the workaround is to force the application into the background and/or lock the screen before calling PresentNotification. When the app is in the background in iOS10 doesn't it suspend processing? If it does, then that won't work.


Dave Nottage wrote:
aneal chandra wrote:

iOS notifications are not working in iOS10 32/64 bit with Berlin or Tokyo. According to
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Mobile_Tutorial:_Using_Notifications_(iOS_and_Android)
it should be a couple of clicks and a few lines of code but I can't make it work, although it works on Android.

Please try and vote for the bug

https://quality.embarcadero.com/browse/RSP-17939

Note that it is currently assigned a priority of 'major' which AFAIK means there is a workaround.
Can anyone post some code detailing how to make this core functionality work in iOS?

Note also that the report refers to push notifications (not notifications in general), and also appears to be a
problem on iOS 10 only. (Check the comments). See also:

https://quality.embarcadero.com/browse/RSP-16762

Contrary to the description in the above report, iOS notifications have no concept of priority (they do on Android).
There's also a distinct lack of exact steps/scenarios, because notifications work for me on iOS 10 as per Apple's specs
i.e. on iOS 10 they will not show if the application is the active one, and the device is unlocked:

https://developer.apple.com/documentation/uikit/uilocalnotification

"If the app is foremost and visible when the system delivers the notification, the app delegate’s
application(_:didReceive:)
is called to process the notification. Use the information in the provided UILocalNotification object to decide what
action to take. *The system does not display any alerts, badge the app’s icon, or play any sounds when the app is
already frontmost.*"

Note the last sentence.

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: iOS notifications not working as advertised  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 11, 2017 4:51 PM   in response to: aneal chandra in response to: aneal chandra
aneal chandra wrote:

Anyway, back to the point - i.e. how to make the PresentNotification actually show a notification in iOS10. From what
you have written it seems to me that the workaround is to force the application into the background and/or lock the
screen before calling PresentNotification. When the app is in the background in iOS10 doesn't it suspend processing?
If it does, then that won't work.

As far as I can ascertain, the appropriate events still fire, i.e. OnReceiveLocalNotification in TNotificationCenter
and OnPushReceived in TPushEvents, so the application can take some action if it is in the foreground.

It would seem illogical to send the app into the background (if that were possible) just so the notification will show;
it would seem wiser to show an alert or change the view and/or (optionally) play a sound.

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
aneal chandra

Posts: 6
Registered: 4/15/01
Re: iOS notifications not working as advertised  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 11, 2017 5:19 PM   in response to: Dave Nottage in response to: Dave Nottage
Dave Nottage wrote:
aneal chandra wrote:

Anyway, back to the point - i.e. how to make the PresentNotification actually show a notification in iOS10. From what
you have written it seems to me that the workaround is to force the application into the background and/or lock the
screen before calling PresentNotification. When the app is in the background in iOS10 doesn't it suspend processing?
If it does, then that won't work.

As far as I can ascertain, the appropriate events still fire, i.e. OnReceiveLocalNotification in TNotificationCenter
and OnPushReceived in TPushEvents, so the application can take some action if it is in the foreground.
Just tried this as it would have been an acceptable workaround. Doesn't work for me, but maybe I'm doing wrong, so can you post your code?

FYI I simply added a ShowMessage to the OnReceiveLocalNotification event you suggested adding. Furthermore in debug with breakpoint the event does not fire. I used the code from the "Present the Notification Message Immediately" section of http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Mobile_Tutorial:_Using_Notifications_(iOS_and_Android)

It would seem illogical to send the app into the background (if that were possible) just so the notification will show;
it would seem wiser to show an alert or change the view and/or (optionally) play a sound.

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: iOS notifications not working as advertised  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 11, 2017 7:06 PM   in response to: aneal chandra in response to: aneal chandra
aneal chandra wrote:

As far as I can ascertain, the appropriate events still fire, i.e. OnReceiveLocalNotification in TNotificationCenter
and OnPushReceived in TPushEvents, so the application can take some action if it is in the foreground.
Just tried this as it would have been an acceptable workaround. Doesn't work for me, but maybe I'm doing wrong, so
can you post your code?

I meant to say: the events should still fire. If they don't, there's another problem. I'll take a look later today.

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02