O'Reilly logo

Appcelerator Titanium Smartphone App Development Cookbook - Second Edition by Jason Kneen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying local notifications on an iPhone

Along with push notifications (which come from a remote server), iOS also supports local notifications, which allow developers to create simple, basic notification alerts that look and act similar to push notifications without the hassle of creating all the certificates and server-side code necessary for push to work. In this recipe, we are going to extend the previous code that we wrote for our background service, and create a local notification when the app is pushed to the background of the system.

How to do it…

Open your project's bg.js file from the previous recipe, and extend it by adding the following code:

var notification = Ti.App.iOS.scheduleLocalNotification({ alertBody: 'Hey, this is a local ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required