CB-3949: Adding code to mitigate broken intents with the application installer

This commit is contained in:
Joe Bowser 2013-06-24 11:31:32 -07:00
parent b032dcca16
commit b83610a653

View File

@ -250,6 +250,19 @@ public class CordovaActivity extends Activity implements CordovaInterface {
}
}
//CB-3949: Workaround for weird Android Launcher Bug!
private void checkIntents()
{
Intent intent = getIntent();
String intentAction = intent.getAction();
if (!isTaskRoot() && intent.hasCategory(Intent.CATEGORY_LAUNCHER) && intentAction != null) {
if(intentAction.equals(Intent.ACTION_MAIN)) {
Log.d("Cordova", "This isn't the root activity. Clearing it and returning to the root activity.");
finish();
return;
}
}
}
/**
* Called when the activity is first created.
*
@ -258,6 +271,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
checkIntents();
Config.init(this);
LOG.d(TAG, "CordovaActivity.onCreate()");
super.onCreate(savedInstanceState);