Search in sources :

Example 21 with CustomEvent

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");
    }
}
Also used : CustomEvent(com.crashlytics.android.answers.CustomEvent) StatsResult(com.eveningoutpost.dexdrip.stats.StatsResult) Sensor(com.eveningoutpost.dexdrip.Models.Sensor)

Example 22 with CustomEvent

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"));
}
Also used : CustomEvent(com.crashlytics.android.answers.CustomEvent) MuteAlertMessage(sugar.free.sightparser.applayer.messages.remote_control.MuteAlertMessage) SingleMessageTaskRunner(sugar.free.sightparser.handling.SingleMessageTaskRunner)

Example 23 with CustomEvent

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"));
}
Also used : CustomEvent(com.crashlytics.android.answers.CustomEvent) DismissAlertMessage(sugar.free.sightparser.applayer.messages.remote_control.DismissAlertMessage) SingleMessageTaskRunner(sugar.free.sightparser.handling.SingleMessageTaskRunner)

Example 24 with CustomEvent

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);
            }
        }
    }
}
Also used : CustomEvent(com.crashlytics.android.answers.CustomEvent) DisconnectedError(sugar.free.sightparser.error.DisconnectedError) IOException(java.io.IOException) IOException(java.io.IOException)

Example 25 with CustomEvent

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);
            }
        }
    }
}
Also used : CustomEvent(com.crashlytics.android.answers.CustomEvent) DisconnectedError(sugar.free.sightparser.error.DisconnectedError) IOException(java.io.IOException) IOException(java.io.IOException)

Aggregations

CustomEvent (com.crashlytics.android.answers.CustomEvent)28 Intent (android.content.Intent)6 Bundle (android.os.Bundle)3 HashMap (java.util.HashMap)3 Activity (android.app.Activity)2 ActivityNotFoundException (android.content.ActivityNotFoundException)2 Context (android.content.Context)2 Uri (android.net.Uri)2 AsyncTask (android.os.AsyncTask)2 AlertDialog (android.support.v7.app.AlertDialog)2 TextUtils (android.text.TextUtils)2 Toast (android.widget.Toast)2 Answers (com.crashlytics.android.answers.Answers)2 Sensor (com.eveningoutpost.dexdrip.Models.Sensor)2 StatsResult (com.eveningoutpost.dexdrip.stats.StatsResult)2 PermissionUtil (com.quran.labs.androidquran.service.util.PermissionUtil)2 QuranFileUtils (com.quran.labs.androidquran.util.QuranFileUtils)2 QuranScreenInfo (com.quran.labs.androidquran.util.QuranScreenInfo)2 QuranSettings (com.quran.labs.androidquran.util.QuranSettings)2 File (java.io.File)2