Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3547] Android: Support Notifications with Custom Views

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionWon't Do
Resolution Date2020-02-19T11:20:20.000+0000
Affected Version/sRelease 1.7.0
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, feature, notifications, rplist
ReporterDawson Toth
AssigneeIngo Muschenetz
Created2011-04-15T03:46:31.000+0000
Updated2020-02-19T11:20:20.000+0000

Description

Feature

Add support for custom views on the notifications created with Ti.Android.createNotification. I believe the term for this is "remote views", something I have also heard of in connection with widgets.

Possible Usage

The following is an idea for how this could be used in an app.js:

var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
win.add(Ti.UI.createLabel({ text: 'Look for the notification! It should be there now.' }));
win.open();

var customView = Ti.UI.createView({ backgroundColor: '#fff' });
customView.add(Ti.UI.createImageView({
    image: 'http://www.innocentenglish.com/wp/wp-content/uploads/2008/01/cats-kitten-sink.jpg',
    width: 70, height: 40,
    left: 20
}));
customView.add(Ti.UI.createLabel({
    text: 'Want code samples? Check out the kitten sink!',
    width: 200, height: 40,
    left: 100
}));

Ti.Android.NotificationManager.notify(
        0, // <-- this is an ID that we can use to clear the notification later
        Ti.Android.createNotification({
            contentView: customView,
            tickerText: 'Want to learn to program?',
            contentIntent: Ti.Android.createPendingIntent({
                intent: Ti.Android.createIntent({
                    url: 'app.js'
                })
            })
        }));

Associated Helpdesk Ticket

http://support.appcelerator.com/tickets/MFU-89832-897">http://support.appcelerator.com/tickets/MFU-89832-897

Comments

No comments

JSON Source