本文整理匯總了Java中org.acra.util.Installation類的典型用法代碼示例。如果您正苦於以下問題:Java Installation類的具體用法?Java Installation怎麽用?Java Installation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Installation類屬於org.acra.util包,在下文中一共展示了Installation類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: copyDebugInfo
import org.acra.util.Installation; //導入依賴的package包/類
/**
* Copy debug information about the device to the clipboard
* @return debugInfo
*/
public String copyDebugInfo() {
StringBuilder sb = new StringBuilder();
// AnkiDroid Version
sb.append("AnkiDroid Version = ").append(VersionUtils.getPkgVersionName()).append("\n\n");
// Android SDK
sb.append("Android Version = " + Build.VERSION.RELEASE).append("\n\n");
// ACRA install ID
sb.append("ACRA UUID = ").append(Installation.id(this)).append("\n");
String debugInfo = sb.toString();
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(debugInfo);
return debugInfo;
}
示例2: sendStats
import org.acra.util.Installation; //導入依賴的package包/類
private void sendStats() {
long lastTs = Settings.getLastSendStats();
Helpers.logDebug("sendStats: lastTs = " + lastTs);
if (lastTs == 0) {
Helpers.logDebug("sendStats: set it to current ts and return");
Settings.setLastSendStats(Helpers.getTimestamp());
return;
}
// if (Helpers.getTimestamp() < lastTs + 3600 * 8) {
if (Helpers.getTimestamp() < lastTs + 10) {
Helpers.logDebug("sendStats: just return");
return;
}
final GDActivity self = this;
Thread statsThread = new Thread() {
@Override
public void run() {
try {
HashMap<String, Double> stats = levelsManager.getLevelsStat();
JSONObject statsJSON = new JSONObject(stats);
String id = Installation.id(self);
int useCheats = org.happysanta.gd.Menu.Menu.isNameCheat(Settings.getName()) ? 1 : 0;
API.sendStats(statsJSON.toString(), id, useCheats, new ResponseHandler() {
@Override
public void onResponse(Response response) {
Helpers.logDebug("send stats OK");
Settings.setLastSendStats(Helpers.getTimestamp());
}
@Override
public void onError(APIException error) {
Helpers.logDebug("send stats error: " + error.getMessage());
// logDebug(error);
// error.printStackTrace();
}
});
} catch (Exception e) {
Helpers.logDebug("send stats exception: " + e.getMessage());
// e.printStackTrace();
}
}
};
statsThread.start();
}