Skip to content

Instantly share code, notes, and snippets.

View damianflannery's full-sized avatar

Damian Flannery damianflannery

View GitHub Profile
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
@damianflannery
damianflannery / JSONSharedPreferences
Created July 3, 2013 13:26
Preferences.putStringSet() does not exist in Gingerbread so you can use this class below as a substitute if you need to target below Android v3.0 (Honeycomb)
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.SharedPreferences;
public class JSONSharedPreferences {
private static final String PREFIX = "json";
public static void saveJSONObject(SharedPreferences prefs, String key, JSONObject object) {
SharedPreferences.Editor editor = prefs.edit();
@damianflannery
damianflannery / gist:5717329
Last active December 18, 2015 03:19
android square okhttp, mimecraft & cookies
public static int okSubmitAttachment(Context ctx, String filePath, String mimeType, String uuid) throws IOException, URISyntaxException, MalformedURLException {
int responseCode = 0;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
String baseUrl = prefs.getString("server_preference", Constants.DEFAULT_BASE_URL);
if (!(baseUrl.charAt(baseUrl.length() - 1) == '/')) {
baseUrl += "/";
}