Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 18    Views: 121

shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
03/10/14 12:20 PM (10 years ago)

Adding counter to app icon?

I'm using an upload image plugin and was wondering how I might go about creating a way to display a number in the app icon to show when a new image has been uploaded. http://s27.postimg.org/cgmmr0e6b/icon_number_ex.png Ideas?
 
tb
buzztouch Evangelist
Profile
Posts: 2050
Reg: Nov 03, 2011
Oxford
32,300
like
03/10/14 01:08 PM (10 years ago)
The 'counter' shows notifications to the app. It counts the number of notifications that the app has given since you've last opened it. The way to get to a number when a new image has been uploaded would be to send out a notification along with it. I'm not sure how you would do this automatically, but you could manually send out a push notification when you upload a new photo. The user would then get a notice on their home screen too (if they accepted the push notifications request).
 
shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
like
03/10/14 01:16 PM (10 years ago)
That's one idea, but I don't really want something as obtrusive as a push notification (image if you got a PN everytime you received a new email), and I don't want to make updates manually, but does seem like there should be a way to trigger a counter when a photo has successfully been submitted.
 
tb
buzztouch Evangelist
Profile
Posts: 2050
Reg: Nov 03, 2011
Oxford
32,300
like
03/10/14 01:22 PM (10 years ago)
The 'counter' won't know what to count outside the app, unless you send a message to the device, and not to the app. This is because without the app open, it won't be able to get any information from the app. Therefore, a message sent directly to the device is required. As far as my knowledge goes, push notifications are the only way to contact the device directly without going through the app. I do realise that push notifications are intrusive. There are probably ways to automate a message, however beyond this, I'd have to do some intensive research. Probably one of our fellow forum users will know. Let's hope we get another reply!
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
03/10/14 01:45 PM (10 years ago)
That's actually called a BADGE. You can use them for things other than Push Notifications. This is a great sample tutorial/code that will give you some idea how they work in an app- http://www.touch-code-magazine.com/how-to-add-a-badge-to-the-application-icon/ You'd basically be adding the line of code- [UIApplication sharedApplication].applicationIconBadgeNumber = 13; Somewhere in a method of the upload image plugin after it sucessfully uploads. Play with that sample app they provide, it's good stuff to learn how to use Badges. There's tons of good "ios add a badge" tutorials out there.
 
tb
buzztouch Evangelist
Profile
Posts: 2050
Reg: Nov 03, 2011
Oxford
32,300
like
03/10/14 01:47 PM (10 years ago)
There you go: someone with better knowledge than me!
 
shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
like
03/10/14 01:48 PM (10 years ago)
That's it. Thanks!
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/10/14 02:16 PM (10 years ago)
Although what ATRAIN says is correct that is the method to change the badge number and is commonly uses to update the badge number from a local notification. The question is why would the user want to see a badge number when they have uploaded an image them selves, strikes me as a bit pointless. What ideally would be done is you would post the images to your own server not email but data. When an image is updated a php script would then send a push notification to update the badge number. (note if there is no text or sound it will just update badge number with no banner) This get's a bit more complicated a push notification cannot increase a badge number it can only set one. This means that the back end/webserver needs to dynamically set up the correct badge number. This would be achieved by everytime the user goes to the gallery or opens the app that a message is sent to the server to say hey I've looked at these images reset the number. It would reset the number by querying how many images it has seen and send that number back up to the server. The server would then be able to work out what the badge number is to send. This sounds complicated and it is, imagine App starts off with no images Number of images images seen push number sent 1 0 1 image posted 2 0 2 image posted 2 2 (count ing in gal) na app opened 2 sent t web 3 0 1 image posted 4 3 (count ing in gal) 0 app open 3 sent to web etc hope that makes a little bit of sense.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/10/14 02:26 PM (10 years ago)
Sorry formatting a bit off.
 
shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
like
03/10/14 02:52 PM (10 years ago)
Thanks for the detailed response Kittsy. I figured it couldn't be that easy:) The badge number wouldn't be for the person uploading the image, it's for the other users to know new content has been added.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/10/14 02:54 PM (10 years ago)
exactly it is a common question, just responding to your email now
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/10/14 03:23 PM (10 years ago)
What plugin are you using? If you dont mind sharing
 
shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
like
03/10/14 03:30 PM (10 years ago)
@cmcoffee It's Image Upload plugin
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/10/14 03:52 PM (10 years ago)
its an open source plugin??
 
shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
like
03/10/14 04:53 PM (10 years ago)
@cmcoffee, Sorry, it was called image uploader in 1.5. It's basically a customized Email Image http://www.buzztouch.com/plugins/plugin.php?pid=A9C6C1CF0FEE84403C554B8. But a badge should work the same for RSS, MacImage Gallery, anything that gets updated - if I understand correctly.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/10/14 05:28 PM (10 years ago)
Oh ok I see. Maybe these sites have something you can use. Www.code4app.com Www.code4app.net
 
shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
like
03/10/14 05:46 PM (10 years ago)
Very cool @cmcoffee. You always seem to come across some great stuff. Thanks for sharing!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/11/14 04:12 AM (10 years ago)
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
03/11/14 07:22 AM (10 years ago)
yup I seen that yesterday, I was playing with it last night, just a shame about backwards compatibility, plus even with the minimum settings it absolutely zapped the battery 100% to 8% in a 5 hour snooze.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.