private synchronized void migrateAPI(SQLiteDatabase db){
  Log.d(LOGTAG,"Migrating API");
  String user=prefs.getString(r.getString(R.string.config_username_key),"");
  String pass=prefs.getString(r.getString(R.string.config_password_key),"");
  String name="OpenStreetMap";
  Log.d(LOGTAG,"Adding default URL with user '" + user + "'");
  addAPI(db,ID_DEFAULT,name,API_DEFAULT,null,null,user,pass,ID_DEFAULT,true,true);
  Log.d(LOGTAG,"Adding default URL without https");
  addAPI(db,ID_DEFAULT_NO_HTTPS,"OpenStreetMap no https",API_DEFAULT_NO_HTTPS,null,null,"","",ID_DEFAULT_NO_HTTPS,true,true);
  Log.d(LOGTAG,"Selecting default API");
  selectAPI(db,ID_DEFAULT);
  Log.d(LOGTAG,"Deleting old user/pass settings");
  Editor editor=prefs.edit();
  editor.remove(r.getString(R.string.config_username_key));
  editor.remove(r.getString(R.string.config_password_key));
  editor.commit();
  Log.d(LOGTAG,"Migration finished");
}

private synchronized void migrateAPI ( SQLiteDatabase db ) { Log . d ( LOGTAG , "Migrating API" ) ; String user = prefs . getString ( r . getString ( R . string . config_username_key ) , "" ) ; String pass = prefs . getString ( r . getString ( R . string . config_password_key ) , "" ) ; String name = "OpenStreetMap" ; Log . d ( LOGTAG , "Adding default URL with user '" + user + "'" ) ; addAPI ( db , ID_DEFAULT , name , API_DEFAULT , null , null , user , pass , ID_DEFAULT , true , true ) ; Log . d ( LOGTAG , "Adding default URL without https" ) ; addAPI ( db , ID_DEFAULT_NO_HTTPS , "OpenStreetMap no https" , API_DEFAULT_NO_HTTPS , null , null , "" , "" , ID_DEFAULT_NO_HTTPS , true , true ) ; Log . d ( LOGTAG , "Selecting default API" ) ; selectAPI ( db , ID_DEFAULT ) ; Log . d ( LOGTAG , "Deleting old user/pass settings" ) ; Editor editor = prefs . edit ( ) ; editor . remove ( r . getString ( R . string . config_username_key ) ) ; editor . remove ( r . getString ( R . string . config_password_key ) ) ; editor . commit ( ) ; Log . d ( LOGTAG , "Migration finished" ) ; }
creates the default api entry using the old - style username / password
