In Project.js cacheBaseLayer, if the cordova state doesn't get set to updating before layers are loaded, tiles will load, which may cause the map to reset, before the sync completes, causing the app to go into a bad state.  Also switched from using getActivity() in ChooseBaselayerDialog because for some reason it returns null sometimes.