Android local notifications

Bernard Devlin bdrunrev at gmail.com
Fri Apr 3 05:04:38 EDT 2015


When I looked at Android notifications a while back, I saw some
irregularity with them being delivered, and with the aural alert of a new
notification.  I haven't looked at this for some time.  However, when I
look at this page

http://developer.android.com/guide/topics/ui/notifiers/notifications.html

it appears that the recommendation is to "update" an existing notification,
rather than send repeated similar messages (unless I'm misreading that
page).

According to this page:
http://lessons.runrev.com/m/4069/l/59312-how-do-i-use-push-notifications-with-android

Livecode does get the ID of the notification.  Is there some way you can
incorporate that ID with the later messages?  I can't remember all the
details about the parameters we need to bundle along with the notification
in Livecode.

According to that Livecode lesson I linked these are the only parameters
available to us from within Livecode.  It could be that an (optional) ID
parameter is also available to us.

LiveCode uses the following fields to store and process push notification
information.

data.body - The message body displayed in the status bar (default: "User
interaction requested").
data.title - The title of the message displayed in the status bar (default:
the app label).
data.badge_value - The badged number to display along with the statusbar
message.
data.play_sound - A Boolean that indicates whether or not a sound should be
played when the notification is received (true / false).
data.payload - The message that is delivered to the app in its remoteAlert
handler.
At a guess, I'd try adding the ID as a parmetet named either "data.ID" , "
data.id" or "data.notifyID".

Hope that works.

Regards,

Bernard

On Fri, Apr 3, 2015 at 7:41 AM, Mark Wilcox <mark at sorcery-ltd.co.uk> wrote:

> Android can delay notifications for power saving reasons. As I understand
> it the more there are from one app and the less the user interacts with
> them, the more likely they are to be delayed.
>
> I think to do what you want more reliably you'd need to use background
> processing (wake up every 30 seconds, clear the current notification and
> replace with a new one) and I don't think LiveCode enables you to that yet.
>
> Mark
>
> Sent from my iPhone
>
> > On 3 Apr 2015, at 05:27, J. Landman Gay <jacque at hyperactivesw.com>
> wrote:
> >
> > Is anyone using local notifications on Android? I need to know more
> about how they work and I can't find much online about it.
> >
> > I need to send notifications every half hour for a 5-minute period, 30
> seconds apart. I have this working in theory; notifications are scheduled
> correctly and mostly fire on time until the user opens the app, when I
> cancel any pending ones.
> >
> > First issue: often some alerts do not trigger at all, or trigger
> sporadically, or are significantly delayed (up to 2 minutes late.) A
> 5-minute interval will have 10 notifications if the user does not respond.
> Sometimes fewer icons appear in the status bar than audio alerts were
> heard. Sometimes more icons appear than audio alerts.
> >
> > Second issue: I would like a way to replace an existing notification
> icon with the next one (every 30 seconds) so that there is only one at a
> time, but I don't see how we can do that. If the phone is sleeping or the
> app is backgrounded we have no control, so to overcome that I need to
> schedule all 10 alerts in a block while the app is frontmost. When those
> come due they all stack up in the notification bar until the user opens the
> app (when I cancel them all.)
> >
> > So briefly, I need:
> >
> > Alerts to trigger on time, every 30 seconds, with no delay
> > A subsequent alert should replace an existing alert
> >
> > The timely delivery is more important than the multiple icons in the
> status bar. Does anyone know how Android prioritizes these? What are the
> rules for the "default" priority, which I assume is what we've got.
> >
> > There are no other apps running on the phone, and it has no cell
> service. It is intended to be a dedicated device for this one app, so there
> shouldn't be anything else running except for normal OS operations.
> >
> > --
> > Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> > HyperActive Software           |     http://www.hyperactivesw.com
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list