com.crashlytics.android.answers.CustomEvent Java Examples

The following examples show how to use com.crashlytics.android.answers.CustomEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SettingsFragment.java    From prayer-times-android with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onPreferenceChange(@NonNull Preference pref, Object newValue) {

    if ("language".equals(pref.getKey()) || "digits".equals(pref.getKey())) {
        if ("language".equals(pref.getKey()))
            Preferences.LANGUAGE.set((String) newValue);
        Activity act = getActivity();
        act.finish();
        Intent i = new Intent(act, act.getClass());
        i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
        act.startActivity(i);

        Answers.getInstance().logCustom(new CustomEvent("Language").putCustomAttribute("lang", (String) newValue));
    }
    return true;
}
 
Example #2
Source File: BuyActivity.java    From Telephoto with Apache License 2.0 6 votes vote down vote up
private void afterPayment() {
    PrefsController.instance.makePro();
    Answers.getInstance().logCustom(new CustomEvent(ANSWER_STEP_BUY).putCustomAttribute("step", "Go Pro!"));
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            new AlertDialog.Builder(BuyActivity.this)
                    .setTitle(R.string.warning)
                    .setMessage(R.string.buy_thank_you_for_bought)
                    .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.dismiss();
                            BuyActivity.this.finish();
                        }
                    })
                    .setIcon(android.R.drawable.ic_dialog_alert)
                    .show();
        }
    });
}
 
Example #3
Source File: DeckFragment.java    From tribbble with Apache License 2.0 6 votes vote down vote up
@Override void onCardSwiped(int direction, int swipedIndex) {
  mCurrentPosition++;
  if (mAdapter.getCount() - swipedIndex <= PRELOAD_THRESHOLD) {
    mCurrentPage++;
    loadNext(0);
  }

  if (direction == RIGHT) {
    Answers.getInstance().logCustom(new CustomEvent("Shot Archived"));
    Shot shot = mAdapter.getItem(swipedIndex);
    ArchiveManager.instance().archive(shot);
    ((MainActivity) getActivity()).notifyShotArchived(shot);
  } else if (direction == LEFT) {
    Answers.getInstance().logCustom(new CustomEvent("Shot Discarded"));
    ArchiveManager.instance().discard(mAdapter.getItem(swipedIndex));
  }
}
 
Example #4
Source File: ServerActivity.java    From EasyVPN-Free with GNU General Public License v3.0 6 votes vote down vote up
private void prepareStopVPN() {
    if (!BuildConfig.DEBUG) {
        try {
            String download = trafficIn.getText().toString();
            download = download.substring(download.lastIndexOf(":") + 2);

            Answers.getInstance().logCustom(new CustomEvent("Connection info")
                    .putCustomAttribute("Country", connectedServer.getCountryLong())
                    .putCustomAttribute("Download", download)
                    .putCustomAttribute("Time", stopwatch.getElapsedTime()));
        } catch (Exception e) {

        }
    }

    statusConnection = false;
    if (waitConnection != null)
        waitConnection.cancel(false);
    connectingProgress.setVisibility(View.GONE);
    adbBlockCheck.setEnabled(availableFilterAds);
    lastLog.setText(R.string.server_not_connected);
    serverConnect.setText(getString(R.string.server_btn_connect));
    connectedServer = null;
}
 
Example #5
Source File: MainActivity.java    From block-this with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    Fragment fragment = null;

    //noinspection SimplifiableIfStatement
    switch(id) {
        case R.id.action_settings:
            Answers.getInstance().logCustom(new CustomEvent("3.0 Menu").putCustomAttribute("Type", "Settings"));
            fragment = new SettingsFragment();
            break;
    }

    //replacing the fragment
    if (fragment != null) {
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.replace(R.id.content_frame, fragment);
        ft.commit();
    }

    return super.onOptionsItemSelected(item);
}
 
Example #6
Source File: CalcTimeConfDialogFragment.java    From prayer-times-android with Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(View view) {
    if (mCalcTime == null) {
        mCalcTime = new CalcTimes(UUID.asInt());
        mCalcTime.setPrayTimes(mPrayTimes);
        mCalcTime.setName(getArguments().getString("city"));
        mCalcTime.setAutoLocation(getArguments().getBoolean("autoCity"));
        mCalcTime.setLat(mPrayTimes.getLatitude());
        mCalcTime.setLng(mPrayTimes.getLongitude());
        mCalcTime.setElv(mPrayTimes.getElevation());
        Answers.getInstance().logCustom(
                new CustomEvent("AddCity").putCustomAttribute("Source", Source.Calc.name()).putCustomAttribute("City", mCalcTime.getName()));
    } else {
        mCalcTime.setPrayTimes(mPrayTimes);
    }
    dismiss();
}
 
Example #7
Source File: Telemetry.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
public static void sendFirmwareReport() {
    try {
        if (JoH.ratelimit("firmware-capture-report", 50000)) {
            Log.d(TAG, "SEND Firmware EVENT START");

            if (Pref.getBooleanDefaultFalse("enable_crashlytics") && Pref.getBooleanDefaultFalse("enable_telemetry")) {
                if (DexCollectionType.getDexCollectionType() == DexcomG5) {

                    final String version = Ob1G5StateMachine.getRawFirmwareVersionString(getTransmitterID());
                    if (version.length() > 0) {
                        Answers.getInstance().logCustom(new CustomEvent("GFirmware")
                                .putCustomAttribute("Firmware", version));
                    }
                }
            }
        }

    } catch (Exception e) {
        Log.e(TAG, "Got exception sending Firmware Report");
    }

}
 
Example #8
Source File: Telemetry.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
public static void sendFirmwareReport() {
    try {
        if (JoH.ratelimit("firmware-capture-report", 50000)) {
            Log.d(TAG, "SEND Firmware EVENT START");

            if (Pref.getBooleanDefaultFalse("enable_crashlytics") && Pref.getBooleanDefaultFalse("enable_telemetry")) {
                if (DexCollectionType.getDexCollectionType() == DexcomG5) {

                    final String version = Ob1G5StateMachine.getRawFirmwareVersionString(getTransmitterID());
                    if (version.length() > 0) {
                        Answers.getInstance().logCustom(new CustomEvent("GFirmware")
                                .putCustomAttribute("Firmware", version));
                    }
                }
            }
        }

    } catch (Exception e) {
        Log.e(TAG, "Got exception sending Firmware Report");
    }

}
 
Example #9
Source File: SightService.java    From SightRemote with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onStatusChange(Status status, long statusTime, long waitTime) {
    Log.d("SightService", "STATUS: " + status);
    SightService.this.status = status;
    statusTime = System.currentTimeMillis();
    if (status == Status.CONNECTED) {
        timeoutTimer.cancel();
        if (tempMac != null) {
            getDataStorage().set("DEVICEMAC", tempMac);
            tempMac = null;
            reconnect = true;
        }
    }
    for (Map.Entry<Long, IStatusCallback> entry : statusCallbackIds.entrySet()) {
        try {
            entry.getValue().onStatusChange(status.name(), statusTime, timeoutWait);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    Answers.getInstance().logCustom(new CustomEvent("Connection Status Changed")
            .putCustomAttribute("Status", status.toString()));
}
 
Example #10
Source File: SightService.java    From SightRemote with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void disconnect(IBinder binder) throws RemoteException {
    if (!verifyCaller("disconnect")) throw new RemoteException("Not authorized");
    if (connectedClients.containsKey(binder)) {
        Answers.getInstance().logCustom(new CustomEvent("Connection Request Withdrawn")
                .putCustomAttribute("Application", getCallerName()));
        Log.d("SightService", "CLIENT DISCONNECTS FROM PUMP");
        binder.unlinkToDeath(connectedClients.get(binder), 0);
        connectedClients.remove(binder);
        if (connectedClients.size() == 0 && connectionThread != null) {
            disconnectTimer = new Timer();
            disconnectTimer.schedule(new TimerTask() {
                @Override
                public void run() {
                    SightService.this.disconnect(false);
                }
            }, DISCONNECT_DELAY);
        }
    }
}
 
Example #11
Source File: SyncService.java    From amiibo with GNU General Public License v2.0 6 votes vote down vote up
@DebugLog
public void onFileRead(AmiiboFile result) {
    CustomEvent event = new CustomEvent("Download");
    event.putCustomAttribute("success", result != null ? "true" : "false");
    Answers.getInstance().logCustom(event);

    if (result != null) {
        Amiibo amiibo = AmiiboFactory.getAmiiboCache().getAmiibo(result.uuid);
        Amiibo to_write = result.toAmiibo();
        if (amiibo != null) {
            to_write.id = amiibo.id;
        }
        to_write.synced = true;
        AmiiboFactory.getAmiiboCache()
                .updateInDatabase(to_write);
    }
}
 
Example #12
Source File: WebTimes.java    From prayer-times-android with Apache License 2.0 6 votes vote down vote up
@NonNull
public static Times add(@NonNull Source source, String city, String id, double lat, double lng) {
    if (source == Source.Calc)
        throw new RuntimeException("Calc is not a WebTimes");
    WebTimes t;
    try {
        t = (WebTimes) source.clz.getConstructor(long.class).newInstance(UUID.asInt());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    t.setSource(source);
    t.setName(city);
    t.setLat(lat);
    t.setLng(lng);
    t.setId(id);
    t.setSortId(99);
    t.scheduleJob();

    Answers.getInstance().logCustom(new CustomEvent("AddCity").putCustomAttribute("Source", source.name()).putCustomAttribute("City", city));
    return t;
}
 
Example #13
Source File: AlarmHelper.java    From KUAS-AP-Material with MIT License 6 votes vote down vote up
public static void setBusNotification(Context context) {
	List<BusModel> busModelList = Utils.loadBusNotify(context);
	if (busModelList != null) {
		for (BusModel model : busModelList) {
			try {
				setBusAlarm(context, model.endStation,
						model.runDateTime == null ? model.Time : model.runDateTime,
						Integer.parseInt(model.cancelKey));
			} catch (Exception e) {
				Answers.getInstance().logCustom(
						new CustomEvent("Gson").putCustomAttribute("Type", "Bus Boot")
								.putCustomAttribute("Exception", e.getMessage()));
			}
		}
	}
}
 
Example #14
Source File: VibrateHelper.java    From KUAS-AP-Material with MIT License 6 votes vote down vote up
public static void setCourseVibrate(Context context) {
	List<CourseModel> courseModelList = Utils.loadCourseVibrate(context);
	if (courseModelList != null) {
		for (int i = 0; i < courseModelList.size(); i++) {
			try {
				CourseModel courseModel = courseModelList.get(i);
				if (i % 2 == 0) {
					setCourseAlarm(context, courseModel.start_time, courseModel.dayOfWeek,
							courseModel.notifyKey * 1000, true);
				} else {
					setCourseAlarm(context, courseModel.end_time, courseModel.dayOfWeek,
							courseModel.notifyKey * 10000, false);
				}
			} catch (Exception e) {
				Answers.getInstance().logCustom(
						new CustomEvent("Gson").putCustomAttribute("Type", "Course Vibrate Set")
								.putCustomAttribute("Exception", e.getMessage()));
			}
		}
	}
}
 
Example #15
Source File: EventSender.java    From Anecdote with Apache License 2.0 6 votes vote down vote up
@Override
public void sendEvent(String eventName, Object... datas) {
    CustomEvent event = new CustomEvent(eventName);

    String key = null;
    for (Object data : datas) {
        if (data == null) {
            data = "";
        }

        // We received a key value in an non assiociative array, the first is a key, the second the value
        if (key == null) {
            key = String.valueOf(data);
        } else {
            event.putCustomAttribute(key, String.valueOf(data));
            key = null;
        }
    }

    Answers.getInstance().logCustom(event);
}
 
Example #16
Source File: MainActivity.java    From KernelAdiutor with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onPostExecute(Boolean donationValid) {
    super.onPostExecute(donationValid);

    MainActivity activity = mRefActivity.get();
    if (activity == null) return;

    if (donationValid && mLicensedCached) {
        activity.launch(0);
    } else if (donationValid && mInternetAvailable) {
        Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.setComponent(new ComponentName("com.grarak.kerneladiutordonate",
                "com.grarak.kerneladiutordonate.MainActivity"));
        activity.startActivityForResult(intent, 0);
    } else if (donationValid) {
        activity.launch(1);
    } else {
        if (mPatched && !BuildConfig.DEBUG) {
            Answers.getInstance().logCustom(new CustomEvent("Pirated")
                    .putCustomAttribute("android_id", Utils.getAndroidId(activity)));
        }
        activity.launch(mPatched ? 3 : -1);
    }
}
 
Example #17
Source File: WebTimes.java    From prayer-times-android with Apache License 2.0 6 votes vote down vote up
@NonNull
public static Times add(@NonNull Source source, String city, String id, double lat, double lng) {
    if (source == Source.Calc)
        throw new RuntimeException("Calc is not a WebTimes");
    WebTimes t;
    try {
        t = (WebTimes) source.clz.getConstructor(long.class).newInstance(UUID.asInt());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    t.setSource(source);
    t.setName(city);
    t.setLat(lat);
    t.setLng(lng);
    t.setId(id);
    t.setSortId(99);
    t.scheduleJob();

    Answers.getInstance().logCustom(new CustomEvent("AddCity").putCustomAttribute("Source", source.name()).putCustomAttribute("City", city));
    return t;
}
 
Example #18
Source File: SettingsFragment.java    From prayer-times-android with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onPreferenceChange(@NonNull Preference pref, Object newValue) {

    if ("language".equals(pref.getKey()) || "digits".equals(pref.getKey())) {
        if ("language".equals(pref.getKey()))
            Preferences.LANGUAGE.set((String) newValue);
        Activity act = getActivity();
        act.finish();
        Intent i = new Intent(act, act.getClass());
        i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
        act.startActivity(i);

        Answers.getInstance().logCustom(new CustomEvent("Language").putCustomAttribute("lang", (String) newValue));
    }
    return true;
}
 
Example #19
Source File: AlarmHelper.java    From KUAS-AP-Material with MIT License 5 votes vote down vote up
public static void setCourseNotification(Context context) {
	List<CourseModel> courseModelList = Utils.loadCourseNotify(context);
	if (courseModelList != null) {
		for (CourseModel courseModel : courseModelList) {
			try {
				setCourseAlarm(context, courseModel.room.trim(), courseModel.title,
						courseModel.start_time, courseModel.dayOfWeek, courseModel.notifyKey);
			} catch (Exception e) {
				Answers.getInstance().logCustom(
						new CustomEvent("Gson").putCustomAttribute("Type", "Course Boot")
								.putCustomAttribute("Exception", e.getMessage()));
			}
		}
	}
}
 
Example #20
Source File: AboutShortcuts.java    From prayer-times-android with Apache License 2.0 5 votes vote down vote up
public static void mail(@NonNull Context ctx) {
    sendMail(ctx);

    Answers.getInstance().logCustom(new CustomEvent("About")
            .putCustomAttribute("action", "mail")
    );
}
 
Example #21
Source File: AboutShortcuts.java    From prayer-times-android with Apache License 2.0 5 votes vote down vote up
public static void reportBug(@NonNull Context ctx) {
    String url = "https://github.com/metinkale38/prayer-times-android/issues";
    openUrl(ctx, url);

    Answers.getInstance().logCustom(new CustomEvent("About")
            .putCustomAttribute("action", "reportBug")
    );
}
 
Example #22
Source File: PoemBuilderActivity.java    From cannonball-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    Crashlytics.log("PoemBuilder: getting back, user cancelled the poem creation");
    Answers.getInstance().logCustom(new CustomEvent("gave up building a poem"));
    super.onBackPressed();
    countDown.cancel();
}
 
Example #23
Source File: AboutShortcuts.java    From prayer-times-android with Apache License 2.0 5 votes vote down vote up
public static void beta(Context ctx) {
    String url = "https://play.google.com/apps/testing/com.metinkale.prayer";
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setData(Uri.parse(url));
    ctx.startActivity(i);

    Answers.getInstance().logCustom(new CustomEvent("About")
            .putCustomAttribute("action", "beta")
    );
}
 
Example #24
Source File: AboutShortcuts.java    From prayer-times-android with Apache License 2.0 5 votes vote down vote up
public static void mail(@NonNull Context ctx) {
    sendMail(ctx);

    Answers.getInstance().logCustom(new CustomEvent("About")
            .putCustomAttribute("action", "mail")
    );
}
 
Example #25
Source File: AboutFragment.java    From prayer-times-android with Apache License 2.0 5 votes vote down vote up
public static void licenses(@NonNull Context ctx) {
    WebView wv = new WebView(ctx);
    wv.loadUrl("file:///android_asset/license.html");
    AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
    builder.setTitle(ctx.getResources().getString(R.string.license)).setView(wv).setCancelable(false);
    builder.setNegativeButton(ctx.getResources().getString(R.string.ok), null);
    builder.show();

    Answers.getInstance().logCustom(new CustomEvent("About")
            .putCustomAttribute("action", "licenses")
    );
}
 
Example #26
Source File: AboutFragment.java    From prayer-times-android with Apache License 2.0 5 votes vote down vote up
public static void libLicences(@NonNull Context ctx) {
    new LibsBuilder()
            .withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
            .withActivityTitle(ctx.getString(R.string.library_licenses))
            .withLibraries()
            .start(ctx);

    Answers.getInstance().logCustom(new CustomEvent("About")
            .putCustomAttribute("action", "libLicenses")
    );
}
 
Example #27
Source File: MyApp.java    From Learning-Resources with MIT License 5 votes vote down vote up
public static void logShareEvent(SharePlatform platform) {
    Bundle bundle = new Bundle();
    bundle.putInt(FirebaseAnalytics.Param.ITEM_ID, 3);
    bundle.putString(FirebaseAnalytics.Param.DESTINATION, platform.getPlatform());
    mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SHARE, bundle);
    Answers.getInstance().logCustom(new CustomEvent("SHARE")
            .putCustomAttribute("DESTINATION", platform.getPlatform())
    );
    Answers.getInstance().logContentView(new ContentViewEvent()
            .putContentName("SHARE")
            .putContentType(platform.getPlatform())
            .putContentId("3"));
}
 
Example #28
Source File: MyApp.java    From Learning-Resources with MIT License 5 votes vote down vote up
public static void logOpenEvent() {
    Bundle bundle = new Bundle();
    bundle.putInt(FirebaseAnalytics.Param.ITEM_ID, 2);
    bundle.putString(FirebaseAnalytics.Param.DESTINATION, DeviceInfo.getDeviceName());
    mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.APP_OPEN, bundle);
    Answers.getInstance().logCustom(new CustomEvent("APP_OPEN")
            .putCustomAttribute("DESTINATION", DeviceInfo.getDeviceName())
    );
    Answers.getInstance().logContentView(new ContentViewEvent()
            .putContentName("APP_OPEN")
            .putContentType(DeviceInfo.getDeviceName())
            .putContentId("2"));
}
 
Example #29
Source File: MyApp.java    From Learning-Resources with MIT License 5 votes vote down vote up
public static void logCaptureEvent() {
    Bundle bundle = new Bundle();
    bundle.putInt(FirebaseAnalytics.Param.ITEM_ID, 1);
    bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Click Picture");
    bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "image");
    mFirebaseAnalytics.logEvent("Click_Picture", bundle);

    Answers.getInstance().logCustom(new CustomEvent("Click_Picture")
            .putCustomAttribute("CONTENT_TYPE", "image")
    );
    Answers.getInstance().logContentView(new ContentViewEvent()
            .putContentName("Click_Picture")
            .putContentType("image")
            .putContentId("1"));
}
 
Example #30
Source File: ThemeChooserActivity.java    From cannonball-android with Apache License 2.0 5 votes vote down vote up
private void setUpPopular() {
    final ImageView popular = (ImageView) findViewById(R.id.popular);
    popular.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Crashlytics.log("ThemeChooser: clicked Popular button");
            Answers.getInstance().logCustom(new CustomEvent("clicked popular"));
            Intent intent = new Intent(ThemeChooserActivity.this, PoemPopularActivity.class);
            startActivity(intent);
        }
    });
}