Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20066] Android: Add support for style in Titanium.Android.Notification

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-01-07T07:16:12.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsAndroid
Labelsandroid, notification, style
ReporterAndrey Tkachenko
AssigneeAshraf Abu
Created2015-11-21T14:45:30.000+0000
Updated2017-08-22T12:55:20.000+0000

Description

Currently [Titanium.Android.Notification](http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Android.Notification) has not support for Big View Styles. Add support for [BigTextStyle](http://developer.android.com/intl/ru/reference/android/app/Notification.BigTextStyle.html), [BigPictureStyle](http://developer.android.com/intl/ru/reference/android/app/Notification.BigPictureStyle.html). This ticket created for future PR.

Comments

  1. Andrey Tkachenko 2015-11-24

    PR: https://github.com/appcelerator/titanium_mobile/pull/7489
       var win = Ti.UI.createWindow({layout:'vertical'});
       
       var btn1 = Ti.UI.createButton({
           title : '1) Add Big Text Notification'
       });
       
       btn1.addEventListener('click', function(e) {
       	var style = Titanium.Android.createBigTextStyle({
           	bigText: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
           	bigContentTitle: "Title for big text",
           	summaryText: "Summary for big text"
          });
          
       	// Create big text style the notification
       	var notification = Titanium.Android.createNotification({
       	    contentTitle: 'Something Happened',
       	    contentText : 'Click to return to the application.',
       	    style: style,
       	    time: Date.now()
       	});
       
           // Send the notification.
           Titanium.Android.NotificationManager.notify(1, notification);
       });
       
       win.add(btn1);
       
       //************************
       
       var btn2 = Ti.UI.createButton({
           title : '2) Add Big Text Notification'
       });
       
       btn2.addEventListener('click', function(e) {
       
       	var style = Ti.Android.createBigTextStyle();
       	style.setBigText("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
       	style.setBigContentTitle('big title');
       	style.setSummaryText('big summmary');
       	   
       	// Create big text style the notification
       	var notification = Ti.Android.createNotification({
       	    contentTitle: 'Something Happened',
       	    contentText : 'Click to return to the application.',
       	    time: Date.now()
       	});
       	
       	notification.setStyle(style);
       
           // Send the notification.
           Titanium.Android.NotificationManager.notify(2, notification);
       });
       
       win.add(btn2);
       
       //***************************
       
       var btn3 = Ti.UI.createButton({
           title : '3) Add Big Image Notification'
       });
          
       btn3.addEventListener('click', function(e) {
       	// For test: 
       	// * Place the image http://codeversed.com/androidifysteve.png to corresponding folder. 
       	// * For example: Resources/android/images/res-xhdpi/  
       	
       		
       	// Create big picture style the notification
       	var notification = Ti.Android.createNotification({
       	    contentTitle: 'Something Happened',
       	    contentText : 'Click to return to the application.',
       	    style: Ti.Android.createBigPictureStyle({
       	    	//bigPicture: "/images/androidifysteve.png",	    	
       	    	//bigPicture: 'http://www.notetab.com/images/More-free-time-thanks-to-NoteTab.jpg',
       	    	bigPicture: Ti.App.Android.R.drawable.androidifysteve,
       	    	bigContentTitle: "Title for big picture",
       	    	summaryText: "Summary for big picture"
       	   }),
       	   time: Date.now()
       	});
       
           // Send the notification.
           Titanium.Android.NotificationManager.notify(3, notification);
       });
       
       win.add(btn3);
       win.open();
       
  2. Ashraf Abu 2015-11-26

    [~falko] Thanks for the PR! I'll look into this.
  3. Ashraf Abu 2016-01-07

    Document updates: https://github.com/appcelerator/titanium_mobile/pull/7619
  4. Ashraf Abu 2016-01-07

    The PR: https://github.com/appcelerator/titanium_mobile/pull/7489 Document updates: https://github.com/appcelerator/titanium_mobile/pull/7619 Both merged.
  5. Lokesh Choudhary 2016-06-27

    Verified the implementation. style works as expected. Closing. Environment: Appc Studio : 4.7.0.201606150733 Ti SDK : 5.4.0.v20160617074028 Ti CLI : 5.0.9 Alloy : 1.9.0 MAC El Capitan : 10.11.4 Appc NPM : 4.2.7-2 Appc CLI : 5.4.0-18 Node: 4.4.4 Nexus 6 - Android 6.0.1
  6. Muhammad Qasim 2016-08-31

    Is it somehow possible to use this feature in ti.cloudpush module for push notifications???
  7. Dirlei DionĂ­sio 2017-08-22

    Is it somehow possible to use this feature in ti.cloudpush module for push notifications??? [2]

JSON Source