Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14139] Android: Intent extra does not seem to be present if the app is using TabGroup

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionNeeds more info
Resolution Date2013-07-01T21:19:46.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 13 API, 2013 Sprint 13
ComponentsAndroid
LabelsSupportTeam
ReporterDavide Cassenti
AssigneeIngo Muschenetz
Created2013-06-06T15:22:18.000+0000
Updated2017-03-16T20:46:14.000+0000

Description

Problem description

There seem to be no intent extra when the app is using TabGroup. The extra data has been added to an intent that is run by a local notification.

Steps to reproduce

Try the following example:
var tabgroup = Ti.UI.createTabGroup();

var win = Ti.UI.createWindow({
	backgroundColor: 'black'
});

var btn = Ti.UI.createButton({
	title: 'Notify'
});
btn.addEventListener('click', function(e) {
	// Intent object to launch the application 
	var intent = Ti.Android.createIntent({
	    flags : Ti.Android.FLAG_ACTIVITY_CLEAR_TOP | Ti.Android.FLAG_ACTIVITY_NEW_TASK,
	    className : 'com.appcelerator.davide.testapp.TestappActivity'
	});
	intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
	intent.putExtra(Ti.Android.EXTRA_TEXT, "notification");
	
	// Create a PendingIntent to tie together the Activity and Intent
	var pending = Titanium.Android.createPendingIntent({
	    intent: intent,
	    flags: Titanium.Android.FLAG_UPDATE_CURRENT
	});
	
	// Create the notification
	var notification = Titanium.Android.createNotification({
	    contentTitle: 'Something Happened',
	    contentText : 'Click to return to the application.',
	    contentIntent: pending
	});
	// Send the notification.
	Titanium.Android.NotificationManager.notify(1, notification);
});

win.add(btn);

var tab = Ti.UI.createTab({
	window: win,
	title: 'Tab 1'
});

tabgroup.addTab(tab);
tabgroup.open();

tabgroup.addEventListener('open', function() {
	tabgroup.getActivity().addEventListener('resume', function(e) {
		var intent = e.source.intent;
		Ti.API.info("intent: " + JSON.stringify(intent));
	    var notification = false;
	    if (intent.hasExtra(Ti.Android.EXTRA_TEXT) && (intent.getStringExtra(Ti.Android.EXTRA_TEXT) == "notification")) {
	        notification = true;
	        intent.putExtra(Ti.Android.EXTRA_TEXT, ""); // remove the EXTRA_TEXT once captured
	    }
	
	    if (notification == true) {
	        // operations to be performed when the app is open from the notification
	        alert('Coming from a notification');
	    } else {
	    	alert('Just resumed the app');
	    }
	});	
})
The extra data seems to be always null

Comments

  1. Vishal Duggal 2013-07-01

    Waiting for further information from CS. resolving for now
  2. Lee Morris 2017-03-16

    Closing ticket as the information that was requested was never provided.

JSON Source