diff --git a/talk/examples/android/res/values/strings.xml b/talk/examples/android/res/values/strings.xml index 08ff54190..a1eea4b3e 100644 --- a/talk/examples/android/res/values/strings.xml +++ b/talk/examples/android/res/values/strings.xml @@ -60,5 +60,9 @@ Enabled Disabled + room_server_url_preference + Room server URL. + Enter a room server URL. + https://apprtc.appspot.com diff --git a/talk/examples/android/res/xml/preferences.xml b/talk/examples/android/res/xml/preferences.xml index cffcb6b8c..4ff79390b 100644 --- a/talk/examples/android/res/xml/preferences.xml +++ b/talk/examples/android/res/xml/preferences.xml @@ -43,4 +43,10 @@ android:dialogTitle="@string/pref_cpu_usage_detection_dlg" android:defaultValue="@string/pref_cpu_usage_detection_default" /> + diff --git a/talk/examples/android/src/org/appspot/apprtc/ConnectActivity.java b/talk/examples/android/src/org/appspot/apprtc/ConnectActivity.java index 7427bb4da..15ca9087e 100644 --- a/talk/examples/android/src/org/appspot/apprtc/ConnectActivity.java +++ b/talk/examples/android/src/org/appspot/apprtc/ConnectActivity.java @@ -71,7 +71,6 @@ public class ConnectActivity extends Activity { public static final String EXTRA_HWCODEC = "org.appspot.apprtc.HWCODEC"; public static final String EXTRA_WEBSOCKET = "org.appspot.apprtc.WEBSOCKET"; private static final String TAG = "ConnectRTCClient"; - private final String APPRTC_SERVER = "https://apprtc.appspot.com"; private final int CONNECTION_REQUEST = 1; private static boolean commandLineRun = false; @@ -88,6 +87,7 @@ public class ConnectActivity extends Activity { private String keyprefBitrateValue; private String keyprefHwCodec; private String keyprefCpuUsageDetection; + private String keyprefRoomServerUrl; private String keyprefRoom; private String keyprefRoomList; private ArrayList roomList; @@ -106,6 +106,7 @@ public class ConnectActivity extends Activity { keyprefBitrateValue = getString(R.string.pref_startbitratevalue_key); keyprefHwCodec = getString(R.string.pref_hwcodec_key); keyprefCpuUsageDetection = getString(R.string.pref_cpu_usage_detection_key); + keyprefRoomServerUrl = getString(R.string.pref_room_server_url_key); keyprefRoom = getString(R.string.pref_room_key); keyprefRoomList = getString(R.string.pref_room_list_key); @@ -252,8 +253,10 @@ public class ConnectActivity extends Activity { } } - String url; - url = APPRTC_SERVER + "/register/" + roomName; + String url = sharedPref.getString( + keyprefRoomServerUrl, + getString(R.string.pref_room_server_url_default)); + url = url + "/register/" + roomName; // Check HW codec flag. boolean hwCodec = sharedPref.getBoolean(keyprefHwCodec, diff --git a/talk/examples/android/src/org/appspot/apprtc/SettingsActivity.java b/talk/examples/android/src/org/appspot/apprtc/SettingsActivity.java index aef1d77b0..43d762088 100644 --- a/talk/examples/android/src/org/appspot/apprtc/SettingsActivity.java +++ b/talk/examples/android/src/org/appspot/apprtc/SettingsActivity.java @@ -43,6 +43,7 @@ public class SettingsActivity extends Activity private String keyprefHwCodec; private String keyprefCpuUsageDetection; private String keyprefSignaling; + private String keyPrefRoomServerUrl; @Override protected void onCreate(Bundle savedInstanceState) { @@ -53,6 +54,7 @@ public class SettingsActivity extends Activity keyprefStartBitrateValue = getString(R.string.pref_startbitratevalue_key); keyprefHwCodec = getString(R.string.pref_hwcodec_key); keyprefCpuUsageDetection = getString(R.string.pref_cpu_usage_detection_key); + keyPrefRoomServerUrl = getString(R.string.pref_room_server_url_key); // Display the fragment as the main content. settingsFragment = new SettingsFragment(); @@ -71,6 +73,7 @@ public class SettingsActivity extends Activity updateSummary(sharedPreferences, keyprefResolution); updateSummary(sharedPreferences, keyprefFps); updateSummary(sharedPreferences, keyprefStartBitrateType); + updateSummary(sharedPreferences, keyPrefRoomServerUrl); updateSummaryBitrate(sharedPreferences, keyprefStartBitrateValue); setBitrateEnable(sharedPreferences); updateSummaryB(sharedPreferences, keyprefHwCodec); @@ -89,8 +92,10 @@ public class SettingsActivity extends Activity @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { - if (key.equals(keyprefResolution) || key.equals(keyprefFps) || - key.equals(keyprefStartBitrateType)) { + if (key.equals(keyprefResolution) || + key.equals(keyprefFps) || + key.equals(keyprefStartBitrateType) || + key.equals(keyPrefRoomServerUrl)) { updateSummary(sharedPreferences, key); } else if (key.equals(keyprefStartBitrateValue)) { updateSummaryBitrate(sharedPreferences, key); @@ -134,5 +139,4 @@ public class SettingsActivity extends Activity bitratePreferenceValue.setEnabled(true); } } - }