Skip to content

Instantly share code, notes, and snippets.

@mbmc
mbmc / SomeFile.java
Last active Nov 13, 2015
Include last git commit sha-1 hash and comment in Android app
View SomeFile.java
public void setCommitInfo() {
if (BuildConfig.DEBUG) {
textView.setText(VersionUtil.COMMIT_INFO);
}
}
@mbmc
mbmc / Application.java
Last active Nov 25, 2019
Delete Parse duplicated Installation object for Android app
View Application.java
// 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) {