Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7843] Android: Kindle Fire bad behavior when installing the app manually launching apk from sdcard

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2012-03-12T08:09:09.000+0000
Affected Version/sRelease 1.7.6, Release 1.8.0.1, Release 2.0.0
Fix Version/sSprint 2012-05, Release 2.0.0
ComponentsAndroid
Labelsmodule_android, qe-testadded
ReporterFederico Casali
AssigneeAllen Yeung
Created2012-02-28T13:32:04.000+0000
Updated2012-03-15T09:44:59.000+0000

Description

Problem description

On Kindle Fire there might be multiple instances of the app after installing manually from the SDCARD

Steps to reproduce

Build a default app from Studio
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');

// create tab group
var tabGroup = Titanium.UI.createTabGroup();


//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({  
    icon:'KS_nav_views.png',
    title:'Tab 1',
    window:win1
});

var label1 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 1',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'auto'
});

win1.add(label1);

//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({  
    title:'Tab 2',
    backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({  
    icon:'KS_nav_ui.png',
    title:'Tab 2',
    window:win2
});

var label2 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 2',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'auto'
});

win2.add(label2);



//
//  add tabs
//
tabGroup.addTab(tab1);  
tabGroup.addTab(tab2);  


// open tab group
tabGroup.open();

1. Copy the app.apk included in ~/Titanium Studio Workspace/testKindle/build/android/bin on the Kindle SDCARD 2. From the device, manually run the APK (using any file manager app available): app is being installed, restarted and run 3. Click on Tab2, then click on Home button. Open again the app. Result: a new instance of the app is openend, displaying Tab1 window. 4. Click on the back button Result: screen relative to the previous instance is being shown. 5. Click again on back button and finally close the app. Start again the app. Result: after the app is being closed and restarted, the app behaves correctly and the issue is no longer reproducible.

Comments

  1. Bill Dawson 2012-03-02

    I don't have a Kindle to test on, but as the description says it happens with "Android 3.0+ devices", I've tested with 1.7.5, 1.8.1 and the master branch (2.0.0) on a T-Mobile G-Slate (Android 3.1) but also on an older device, an HTC Desire running Android 2.2. I'm not able to reproduce the problem. These are my precise testing steps: 1) Copy app.apk to the sdcard. 2) Using the ASTRO File Manager, locate the app.apk on the sdcard, tap it and select "Install". 3) When the install is complete select "Open". 4) The application launches. In Android 2.2, it gives the warning that the application should be re-launched (android bug 2373, lack of the CATEGORY_LAUNCHER intent category, a known issue with built-in workaround). Does not occur in Android 3.1. So in Android 2.2, I go head and let it re-launch as directed. 5) I select Tab 2. 6) I tap the Home button. 7) On Android 3.1, I tap the running apps button and re-select the app to bring it forward again. On Android 2.2, I long press the home key to bring up the recent apps list, then select the app to bring it forward again. 8) When the app comes forward, it is still on Tab 2.
  2. Bill Dawson 2012-03-02

    Please list specifically the devices (and their android versions) this behavior has been seen on (beyond the Fire).
  3. Bill Dawson 2012-03-02

    If i alter my test step 7 on Android 3.1 by using the application menu to re-open the app (rather than the running apps button), I see the described behavior.
  4. Bill Dawson 2012-03-06

    With this change, we now detect [Android bug 2373](http://code.google.com/p/android/issues/detail?id=2373) in Honeycomb and above (3.0+) accurately as well (we have detected it in <3.0 for a long time now.) Note that the described behavior (the fail case) is true of *all* Android applications, not just ones created in Titanium. Android bug 2373 has been around for a long time and remains unaddressed by Google. It's not clear if they consider it a bug at all. We offer a workaround for it, which is to force the application to re-start when opened by the Android application installer. For ways to customize the message that the user receives when the application is forced to re-launch after installation, see the Wiki page re tiapp.xml: https://wiki.appcelerator.org/display/guides/tiapp.xml+and+timodule.xml+Reference (search for "2373" on that page to jump to the section on this bug.)
  5. Bill Dawson 2012-03-06

    Pull request ready https://github.com/appcelerator/titanium_mobile/pull/1568
  6. Allen Yeung 2012-03-11

    Added a second PR for this: https://github.com/appcelerator/titanium_mobile/pull/1636
  7. Dustin Hyde 2012-03-13

    Closing as Fixed. SDK: 2.0.0.v20120312213243 Android: V8, Rhino Studio: 2.0.0.201203121914 OS: Snow Leopard Devices Tested: Nexus One 2.2.2, Kindle Fire 6.2.2, Xoom 3.2.1, Galaxy Nexus 4.0.2

JSON Source