Skip to content

Instantly share code, notes, and snippets.

@mbmc
mbmc / SomeFile.java
Last active November 13, 2015 01:30
Include last git commit sha-1 hash and comment in Android app
public void setCommitInfo() {
if (BuildConfig.DEBUG) {
textView.setText(VersionUtil.COMMIT_INFO);
}
}
@mbmc
mbmc / Application.java
Last active November 25, 2019 14:36
Delete Parse duplicated Installation object for Android app
// Android app
private void setupParse(Context context) {
Parse.initialize(this, <PARSE_APP_ID>, <PARSE_CLIENT_KEY>);
ParseInstallation.getCurrentInstallation().put("uniqueId", getWifiMacAddress(context));
ParseInstallation.getCurrentInstallation().saveInBackground();
}
private String getWifiMacAddress(Context context) {
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
if (wifiManager != null && wifiManager.getConnectionInfo() != null) {