[TIMOB-3547] Android: Support Notifications with Custom Views
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Closed |
Resolution | Won't Do |
Resolution Date | 2020-02-19T11:20:20.000+0000 |
Affected Version/s | Release 1.7.0 |
Fix Version/s | n/a |
Components | Android |
Labels | android, feature, notifications, rplist |
Reporter | Dawson Toth |
Assignee | Ingo Muschenetz |
Created | 2011-04-15T03:46:31.000+0000 |
Updated | 2020-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
No comments