use of com.crashlytics.android.answers.CustomEvent in project xDrip-plus by jamorham.
the class Telemetry method sendCaptureReport.
/*
No personal information is sent.
Only the level of success in receiving sensor data and
the make/model/version/settings/type of phone and collector used.
This is to try to find any patterns relating to successful combinations, for example
G5 collection working better with Samsung devices or not.
*/
public static void sendCaptureReport() {
try {
if (JoH.ratelimit("capture-report", 50000)) {
Log.d(TAG, "SEND EVENT START");
if (Pref.getBooleanDefaultFalse("enable_crashlytics") && Pref.getBooleanDefaultFalse("enable_telemetry")) {
final Sensor sensor = Sensor.currentSensor();
if (sensor != null) {
if (JoH.msSince(sensor.started_at) > 86400000) {
final StatsResult statsResult = new StatsResult(PreferenceManager.getDefaultSharedPreferences(xdrip.getAppContext()), true);
final int capture_percentage = statsResult.getCapturePercentage();
final int capture_set = (capture_percentage / 10) * 10;
if (capture_set > 60) {
final boolean use_transmiter_pl_bluetooth = Pref.getBooleanDefaultFalse("use_transmiter_pl_bluetooth");
final boolean use_rfduino_bluetooth = Pref.getBooleanDefaultFalse("use_rfduino_bluetooth");
final String subtype = (use_transmiter_pl_bluetooth ? "TR" : "") + (use_rfduino_bluetooth ? "RF" : "") + (Home.get_forced_wear() ? "W" : "") + (NFCReaderX.used_nfc_successfully ? "N" : "");
final String capture_id = DexCollectionType.getDexCollectionType().toString() + subtype + " Captured " + capture_set;
Log.d(TAG, "SEND CAPTURE EVENT PROCESS: " + capture_id);
String watch_model = "";
if (Home.get_forced_wear()) {
// anonymize watch model
final String wear_node = Pref.getStringDefaultBlank("node_wearG5");
if (wear_node.length() > 0) {
final String[] wear_array = wear_node.split(" ");
for (String ii : wear_array) {
if (!ii.contains("|"))
watch_model = watch_model + ii;
}
}
}
if (watch_model.length() > 0) {
Answers.getInstance().logCustom(new CustomEvent(capture_id).putCustomAttribute("Model", Build.MODEL + " " + Build.VERSION.RELEASE).putCustomAttribute("Manufacturer", Build.MANUFACTURER).putCustomAttribute("Version", Build.VERSION.RELEASE).putCustomAttribute("xDrip", getVersionDetails()).putCustomAttribute("Watch", watch_model).putCustomAttribute("Percentage", capture_percentage));
} else {
Answers.getInstance().logCustom(new CustomEvent(capture_id).putCustomAttribute("Model", Build.MODEL + " " + Build.VERSION.RELEASE).putCustomAttribute("Manufacturer", Build.MANUFACTURER).putCustomAttribute("Version", Build.VERSION.RELEASE).putCustomAttribute("xDrip", getVersionDetails()).putCustomAttribute("Percentage", capture_percentage));
}
}
} else {
Log.d(TAG, "Sensor not running for more than 24 hours yet");
}
} else {
Log.d(TAG, "No sensor active");
}
Log.d(TAG, "SEND EVENT DONE");
}
}
} catch (Exception e) {
Log.e(TAG, "Got exception sending Capture Report");
}
}
use of com.crashlytics.android.answers.CustomEvent in project SightRemote by TebbeUbben.
the class AlertService method muteAlert.
public void muteAlert() {
MuteAlertMessage muteAlertMessage = new MuteAlertMessage();
muteAlertMessage.setAlertID(latestId);
new SingleMessageTaskRunner(serviceConnector, muteAlertMessage).fetch(errorToastCallback);
Answers.getInstance().logCustom(new CustomEvent("Mute Alert"));
}
use of com.crashlytics.android.answers.CustomEvent in project SightRemote by TebbeUbben.
the class AlertService method dismissAlert.
public void dismissAlert() {
DismissAlertMessage dismissAlertMessage = new DismissAlertMessage();
dismissAlertMessage.setAlertID(latestId);
new SingleMessageTaskRunner(serviceConnector, dismissAlertMessage).fetch(errorToastCallback);
Answers.getInstance().logCustom(new CustomEvent("Dismiss Alert"));
}
use of com.crashlytics.android.answers.CustomEvent in project SightRemote by TebbeUbben.
the class Pipeline method send.
public void send(Object message) {
if (message instanceof Exception) {
Exception exception = (Exception) message;
Log.d("SightService", "EXCEPTION: " + exception.getClass().getName() + ": " + exception.getMessage());
if (!(exception instanceof DisconnectedError))
Answers.getInstance().logCustom(new CustomEvent("Exception In Pipeline").putCustomAttribute("Message", exception.getClass().getSimpleName() + ": " + exception.getMessage()));
}
for (Handler handler : handlers) {
if (handler instanceof OutboundHandler) {
OutboundHandler outboundHandler = (OutboundHandler) handler;
try {
outboundHandler.onOutboundMessage(message, this);
} catch (IOException e) {
setStatus(Status.DISCONNECTED);
} catch (Exception e) {
send(e);
}
}
}
}
use of com.crashlytics.android.answers.CustomEvent in project SightRemote by TebbeUbben.
the class Pipeline method receive.
public void receive(Object message) {
if (message instanceof Exception) {
Exception exception = (Exception) message;
Log.d("SightService", "EXCEPTION: " + exception.getClass().getName() + ": " + exception.getMessage());
if (!(exception instanceof DisconnectedError))
Answers.getInstance().logCustom(new CustomEvent("Exception In Pipeline").putCustomAttribute("Message", exception.getClass().getSimpleName() + ": " + exception.getMessage()));
}
for (Handler handler : handlers) {
if (handler instanceof InboundHandler) {
InboundHandler inboundHandler = (InboundHandler) handler;
try {
inboundHandler.onInboundMessage(message, this);
} catch (IOException e) {
setStatus(Status.DISCONNECTED);
} catch (Exception e) {
receive(e);
}
}
}
}
Aggregations