[TIMOB-24497] Android: Resuming app from intent does not provide EXTRA
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-04-21T22:34:42.000+0000 |
Affected Version/s | Release 6.0.2 |
Fix Version/s | Release 6.0.4 |
Components | Android |
Labels | qe-6.0.3 |
Reporter | Gary Mathews |
Assignee | Gary Mathews |
Created | 2017-03-17T15:12:30.000+0000 |
Updated | 2017-04-21T23:51:21.000+0000 |
Description
1. Press "CREATE SHORTCUT"
2. Kill the app
3. Start the app via shortcut - observe correct behaviour (WITH EXTRA: TEST)
4. Move app into background
5. Resume the app using shortcut - observe invalid behaviour WITH EXTRA : null
var win = Ti.UI.createWindow({
layout: 'vertical'
}),
bar = Ti.UI.createView({
layout: 'horizontal',
width: Ti.UI.FILL,
height: Ti.UI.SIZE
})
createShortcut = Ti.UI.createButton({
title: 'CREATE SHORTCUT',
left: 0
}),
clear = Ti.UI.createButton({
title: 'CLEAR',
right: 0
}),
scrollView = Ti.UI.createScrollView({
layout: 'vertical',
height: Ti.UI.FILL,
backgroundColor: 'white'
});
// create homescreen shortcut
createShortcut.addEventListener('click', function (e) {
var currentIntent = Ti.Android.currentActivity.getIntent(),
shortcutIntent = Ti.Android.createIntent({
action: "com.android.launcher.action.INSTALL_SHORTCUT",
});
currentIntent.setAction(Ti.Android.ACTION_MAIN);
currentIntent.putExtra("shortcut", "TEST");
currentIntent.addCategory(Ti.Android.CATEGORY_HOME);
shortcutIntent.putExtra(Ti.Android.EXTRA_SHORTCUT_NAME, "SHORTCUT");
shortcutIntent.putExtra(Ti.Android.EXTRA_SHORTCUT_INTENT, currentIntent);
Ti.Android.currentActivity.sendBroadcast(shortcutIntent);
});
// clear intent log
clear.addEventListener('click', function (e) {
scrollView.removeAllChildren();
});
// intent listener
Ti.Android.currentActivity.addEventListener('newintent', function (e) {
scrollView.add(Ti.UI.createLabel({
top: 10,
color: 'black',
text: 'INTENT ' + JSON.stringify(e.intent) + ' WITH EXTRA: ' + e.intent.getStringExtra('shortcut')
}));
});
// launch intent
scrollView.add(Ti.UI.createLabel({
top: 10,
color: 'black',
text: 'LAUNCH INTENT ' + JSON.stringify(Ti.Android.currentActivity.getIntent()) + ' WITH EXTRA: ' + Ti.Android.currentActivity.getIntent().getStringExtra('shortcut')
}));
bar.add(createShortcut);
bar.add(clear);
win.add(bar);
win.add(scrollView);
win.open();
master: https://github.com/appcelerator/titanium_mobile/pull/8894
6_0_X: https://github.com/appcelerator/titanium_mobile/pull/8901
{noformat} Mac OS Version : 10.12.3 Appc CLI : 6.1.0 Appc NPM : 4.2.9-1 Node : v4.6.0 Device: Nexus 5x(6.0.1) Pixel XL(7.1.2) Emulator: (6.0), (4.4.2) {noformat} Using above env passed FR. After merge, the changes are present in SDK
6.0.3.v20170322110142
. *Closing*Since this PR and the related ticket are inter-related, will reopen this and move to SDK 6.0.4 since we are unable to merge the other PR.
6_0_X: https://github.com/appcelerator/titanium_mobile/pull/8910
Tested with 6.0.4.v20170420100617 -> doesnt work Tested with 6.1.0.v20170420092509 -> works fine Has this been added into latest 6.0.4 build?
FR Done. Merged 6.0.4 PR waiting for build from CI to close.
Verified the fix in 6.0.4.v20170421153428. Closing.