[TIMOB-2091] Android: Support Android Notification Service

GitHub Issuen/a
TypeNew Feature
Resolution Date2011-04-17T01:58:04.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M06
Labelsandroid, feature, release-1.6.0, rplist
ReporterDon Thorp
AssigneeDon Thorp


See http://developer.android.com/reference/android/app/NotificationManager.html"> Notification Manager, http://developer.android.com/reference/android/app/Notification.html"> Notification, and http://developer.android.com/guide/topics/ui/notifiers/notifications.html"> Guide

Use Titanium.Android.NotificationManager as the module have it provide a createNotification() method that accepts a dictionary.

NotificationManager will expose
- notify(int id, NotificationProxy proxy) - cancel(int id) - cancelAll() - createNotification({/ create options /}

Requires support from Intent, PendingIntent, and Activity




  1. Don Thorp 2011-04-15

    (from [e31b041bd0e5bbc6f79c029a361184b176c08c76]) [#2091 state:open] Initial support, no documentation. http://github.com/appcelerator/titanium_mobile/commit/e31b041bd0e5bbc6f79c029a361184b176c08c76"> http://github.com/appcelerator/titanium_mobile/commit/e31b041bd0e5b...

  2. Don Thorp 2011-04-15

    (from [ab390853b5da78bd186c9051dec986cfc9e3b656]) [#2091] refactored the helper so I can get the id http://github.com/appcelerator/titanium_mobile/commit/ab390853b5da78bd186c9051dec986cfc9e3b656"> http://github.com/appcelerator/titanium_mobile/commit/ab390853b5da7...

  3. Don Thorp 2011-04-15

    (from [69df280971e6a7c76ce31f072eda0b9b287097ee]) [#1589 #2091 #1590 state:open] Additional methods on Intent, PendingIntent, and addition of NotificationManager module http://github.com/appcelerator/titanium_mobile/commit/69df280971e6a7c76ce31f072eda0b9b287097ee"> http://github.com/appcelerator/titanium_mobile/commit/69df280971e6a...

  4. Andrew Heebner 2011-04-15

    Small bug here, dunno if the icon is supposed to be attached to a resource or not, but it seems from the java source that it's included dynamically, although it fails out with (no matter where the icon is located):

       10-22 12:24:43.615: WARN/TiNotification(7975): (kroll$1) [40,29802] No image found for stat_notify_missed_call.png

    Code to reproduce:

       var win = Ti.UI.createWindow({
           backgroundColor : 'gray'
       // notification number, increments automagically
       var i = 1;
       var btn = Ti.UI.createButton({
           title: 'Add Notification'
       btn.addEventListener('click', function(e) {
           createNote('Someone Called!', '555-555-5555', 'New missed call!');
       function createNote(title, text, ticker) {
           var activity = Ti.Android.createActivity();
           var intent = Ti.Android.createIntent({
               action: Ti.Android.ACTION_DIAL, 
               data: "tel:555" 
           var pending = Ti.Android.createPendingIntent({ 
               'activity': activity,
               'intent': intent,
               'type': Ti.Android.PENDING_INTENT_FOR_ACTIVITY,
               'flags': 1073741824
           var ts = new Date().getTime();
           var notification = Ti.Android.NotificationManager.createNotification({
               icon: 'stat_notify_missed_call.png',
               contentIntent: pending,
               contentText: text,
               when: ts,
               tickerText: ticker
           Ti.Android.NotificationManager.notify(i, notification); 
  5. Don Thorp 2011-04-15

    @Andrew please try and contact us via support/IRC first especially on new features that haven't been completed. You'll have to use the multidensity support and place your icon in Resources/android/images/[high|medium|low] so that it gets placed into the res/drawables area correctly. We are also going to have resources that are injectable via a new platforms/android folder in the root of your project, but we haven't finished testing that yet.

  6. Andrew Heebner 2011-04-15

    No, problem, my apologies. Just trying to stay on the cutting edge here at work, sometimes i do tend to get a bit overzealous. :)

  7. Don Thorp 2011-04-15

    not exactly sure why it was ever moved to in-progress.

  8. Marshall Culpepper 2011-04-15

    (from [107833084490d163f9b4238b3557ed07c6624150]) better Android support for Notifications and initial support for RemoteViews we can now fully customize notifications with custom Android layouts, and have full access to all of the options provided in the Android Notification API. PendingIntent has also received an updated API. Updated and Added doc for RemoteViews, Notification, NotificationManager, and PendingIntent
    [#2091 state:fixed-in-qa] [#2835 state:fixed-in-qa] https://github.com/appcelerator/titanium_mobile/commit/107833084490d163f9b4238b3557ed07c6624150"> https://github.com/appcelerator/titanium_mobile/commit/107833084490...

  9. Opie Cyrus 2011-04-15

    verified emulator 2.2 with attached test provided by Marshall

JSON Source