import static ro.ieval.fonbot.R.string.unknown_command;
import static ro.ieval.fonbot.R.string.wipetype_should_be_one_of;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Arrays;
import java.util.Locale;
context.startService(intent);
}
+ /**
+ * Gets the server URL according to the user preferences.
+ *
+ * @param context Context instance
+ * @param path URL path
+ * @return the server URL
+ * @throws MalformedURLException if the user preferences create an invalid URL
+ */
+ public static URL getServerURL(final Context context, final String path) throws MalformedURLException{
+ final String hostname=PreferenceManager.getDefaultSharedPreferences(context).getString("hostname", "ieval.ro");
+ final int port=Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(context).getString("port", "7777"));
+ final URL url=new URL("http", hostname, port, path);
+ return url;
+ }
+
/**
* Executes a given command
*