Badge Notification

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

Post Reply
marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Badge Notification

Post by marcelloe » Mon Dec 16, 2013 4:41 pm

I want to use the badge notification to put a number next to the icon if there is an image in one of the Graphics. Do I need to use the Push notification that is used in the lesson?

Thanks

Mark

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Badge Notification

Post by LCNeil » Tue Dec 17, 2013 1:38 pm

HI Mark,

All you would need to do is use the iphoneSetNotificationBadgeValue command to set this number when an image is imported.

You can test this by creating a button and then placing the following script-

on mouseUp
iphoneSetNotificationBadgeValue 10
end mouseUp

You should notice the number "10" next to your iOS app icon.

Kind Regards

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding


marcelloe
Posts: 140
Joined: Thu Oct 17, 2013 2:26 pm

Re: Badge Notification

Post by marcelloe » Tue Dec 17, 2013 8:29 pm

This is what i am trying to do to set the badge notification. Am I on the right path?

Code: Select all

function iphoneSetNotificationBadgeValue ()
 repeat with x = 1 to 5
if image x is not empty then
 iphoneSetNotificationBadgeValue to x
end repeat
end if
end iphoneSetNotificationBadgeValue

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Badge Notification

Post by LCNeil » Wed Dec 18, 2013 12:13 pm

Hi Mark,

You were almost there :)

A few things i noted were-

- You were trying to call the iphoneSetNotificationBadgeValue as a function. For simplicity I have turned this into a handler.
- You are not setting iphoneSetNotificationBadgeValue in your script so you need to remove the "to"
- the end if was in the wrong place (swapped with end repeat)

Code: Select all

on iphoneSetBadge
   repeat with x = 1 to 5
      if image x is not empty then
         iphoneSetNotificationBadgeValue x
      end if
   end repeat
end iphoneSetBadge
Kind Regards

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
LiveCode – Realize fast, compile-free coding


Post Reply

Return to “idea2app and Coding School”