com.crashlytics.android.answers.Answers Java Examples

The following examples show how to use com.crashlytics.android.answers.Answers. 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: 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 #2
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 #3
Source File: HomeActivity.java    From EasyVPN-Free with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);

    homeContextRL = (RelativeLayout) findViewById(R.id.homeContextRL);
    countryList = dbHelper.getUniqueCountries();

    long totalServ = dbHelper.getCount();
    if (!BuildConfig.DEBUG)
        Answers.getInstance().logCustom(new CustomEvent("Total servers")
            .putCustomAttribute("Total servers", totalServ));

    String totalServers = String.format(getResources().getString(R.string.total_servers), totalServ);
    ((TextView) findViewById(R.id.homeTotalServers)).setText(totalServers);

    initMap();
}
 
Example #4
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 #5
Source File: PoemBuilderActivity.java    From cannonball-android with Apache License 2.0 6 votes vote down vote up
private void createPoem() {
    if (poemContainer.getChildCount() > 0) {
        final String poemText = getPoemText();
        final SparseIntArray imgList = poemTheme.getImageList();
        // the line below seems weird, but relies on the fact that the index of SparseIntArray could be any integer
        final int poemImage = imgList.keyAt(imgList.indexOfValue(imgList.get(poemImagePager.getCurrentItem() + 1)));
        Crashlytics.setString(App.CRASHLYTICS_KEY_POEM_TEXT, poemText);
        Crashlytics.setInt(App.CRASHLYTICS_KEY_POEM_IMAGE, poemImage);

        Answers.getInstance().logCustom(new CustomEvent("clicked save poem")
                .putCustomAttribute("poem size", poemText.length())
                .putCustomAttribute("poem theme", poemTheme.getDisplayName())
                .putCustomAttribute("poem image", poemImage));

        AppService.createPoem(getApplicationContext(),
                poemText,
                poemImage,
                poemTheme.getDisplayName(),
                dateFormat.format(Calendar.getInstance().getTime()));
    } else {
        Toast.makeText(getApplicationContext(),
                getResources().getString(R.string.toast_wordless_poem), Toast.LENGTH_SHORT)
                .show();
        Crashlytics.log("PoemBuilder: User tried to create poem without words on it");
    }
}
 
Example #6
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 #7
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 #8
Source File: LoginActivity.java    From cannonball-android with Apache License 2.0 6 votes vote down vote up
private void setUpDigitsButton() {
    phoneButton = (DigitsAuthButton) findViewById(R.id.phone_button);
    phoneButton.setAuthTheme(R.style.AppTheme);
    phoneButton.setCallback(new AuthCallback() {
        @Override
        public void success(DigitsSession digitsSession, String phoneNumber) {
            SessionRecorder.recordSessionActive("Login: digits account active", digitsSession);
            Answers.getInstance().logLogin(new LoginEvent().putMethod("Digits").putSuccess(true));
            startThemeChooser();
        }

        @Override
        public void failure(DigitsException e) {
            Answers.getInstance().logLogin(new LoginEvent().putMethod("Digits").putSuccess(false));
            Toast.makeText(getApplicationContext(),
                    getResources().getString(R.string.toast_twitter_digits_fail),
                    Toast.LENGTH_SHORT).show();
            Crashlytics.logException(e);
        }
    });
}
 
Example #9
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 #10
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 #11
Source File: SightService.java    From SightRemote with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void requestMessage(byte[] message, IMessageCallback callback) throws RemoteException {
    if (!verifyCaller("requestMessage")) throw new RemoteException("Not authorized");
    final AppLayerMessage msg = (AppLayerMessage) SerializationUtils.deserialize(message);
    Answers.getInstance().logCustom(new CustomEvent("Message Requested")
            .putCustomAttribute("Application", getCallerName())
            .putCustomAttribute("Message", msg.getClass().getSimpleName()));
    if (firewall.isAllowed(msg)) {
        MessageRequest messageRequest = new MessageRequest(msg, callback, callback.asBinder());
        if (pipeline != null && status == Status.CONNECTED)
            pipeline.requestMessage(messageRequest);
    } else {
        showToast("Blocked by SiteRemote firewall preference" + " :: " + msg.toString());
        callback.onError(SerializationUtils.serialize(new NotAuthorizedError("Blocked by Firewall preference")));
    }
}
 
Example #12
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 #13
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 #14
Source File: ApplicationController.java    From amiibo with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Fabric.with(this, new Crashlytics(), new Answers());

    _updated = false;
    setInUpdate(false);

    //init the database orm
    FlowManager.init(this);

    //init the AmiiboHelper
    AmiiboHelper.init();

    mApplicationBus = EventBus.builder().build();

    mApplicationBus.register(this);

    AmiitoolFactory.getInstance().init(this);
}
 
Example #15
Source File: MainApp.java    From BusyBox with Apache License 2.0 6 votes vote down vote up
@Override public void onCreate() {
  super.onCreate();
  MultiDex.install(this);

  // Logging
  if (BuildConfig.DEBUG) {
    Jot.add(new Jot.DebugLogger());
  } else {
    Jot.add(new CrashlyticsLogger());
  }

  // Fabric
  Fabric.with(this, new Crashlytics(), new Answers());
  Analytics.add(AnswersLogger.getInstance());
  // Crashlytics
  Crashlytics.setString("GIT_SHA", BuildConfig.GIT_SHA);
  Crashlytics.setString("BUILD_TIME", BuildConfig.BUILD_TIME);

  FirebaseMessaging.getInstance().subscribeToTopic("main-" + BuildConfig.FLAVOR);
}
 
Example #16
Source File: AboutActivity.java    From cannonball-android with Apache License 2.0 6 votes vote down vote up
private void setUpSignOut() {
    final TextView bt = (TextView) findViewById(R.id.deactivate_accounts);
    bt.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Twitter.getSessionManager().clearActiveSession();
            Digits.getSessionManager().clearActiveSession();
            SessionRecorder.recordSessionInactive("About: accounts deactivated");
            Answers.getInstance().logLogin(new LoginEvent().putMethod("Twitter").putSuccess(false));
            Answers.getInstance().logLogin(new LoginEvent().putMethod("Digits").putSuccess(false));

            Toast.makeText(getApplicationContext(), "All accounts are cleared",
                    Toast.LENGTH_SHORT).show();
        }
    });
}
 
Example #17
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 #18
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 #19
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 #20
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 #21
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 #22
Source File: AboutShortcuts.java    From prayer-times-android with Apache License 2.0 5 votes vote down vote up
public static void github(@NonNull Context ctx) {
    String url = "https://github.com/metinkale38/prayer-times-android";
    openUrl(ctx, url);

    Answers.getInstance().logCustom(new CustomEvent("About")
            .putCustomAttribute("action", "github")
    );
}
 
Example #23
Source File: MyApp.java    From Learning-Resources with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    mInstance = this;
    Fabric.with(this, new Answers());
    mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
}
 
Example #24
Source File: BusModel.java    From KUAS-AP-Material with MIT License 5 votes vote down vote up
@Override
public boolean equals(Object o) {
	try {
		return o instanceof BusModel &&
				EndEnrollDateTime.equals(((BusModel) o).EndEnrollDateTime) &&
				endStation.equals(((BusModel) o).endStation) &&
				runDateTime.equals(((BusModel) o).runDateTime) &&
				cancelKey.equals(((BusModel) o).cancelKey);
	} catch (Exception e) {
		Answers.getInstance().logCustom(
				new CustomEvent("Gson").putCustomAttribute("Type", "Bus Equals")
						.putCustomAttribute("Exception", e.getMessage()));
		return false;
	}
}
 
Example #25
Source File: EventSender.java    From Anecdote with Apache License 2.0 5 votes vote down vote up
@Override
public void sendView(String name, String type) {
    ContentViewEvent contentViewEvent = new ContentViewEvent();

    contentViewEvent.putContentName(name);
    contentViewEvent.putContentType(type);

    Answers.getInstance().logContentView(contentViewEvent);
}
 
Example #26
Source File: CourseModel.java    From KUAS-AP-Material with MIT License 5 votes vote down vote up
@Override
public boolean equals(Object o) {
	try {
		return o instanceof CourseModel && title.equals(((CourseModel) o).title) &&
				room.equals(((CourseModel) o).room) &&
				start_time.equals(((CourseModel) o).start_time) &&
				weekday.equals(((CourseModel) o).weekday) &&
				section.equals(((CourseModel) o).section);
	} catch (Exception e) {
		Answers.getInstance().logCustom(
				new CustomEvent("Gson").putCustomAttribute("Type", "Course Equals")
						.putCustomAttribute("Exception", e.getMessage()));
		return false;
	}
}
 
Example #27
Source File: SpectreApplication.java    From quill with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    Fabric.with(this, new Crashlytics(), new Answers());
    if (BuildConfig.DEBUG) {
        Timber.plant(new Timber.DebugTree());
    } else {
        Timber.plant(new CrashReportingTree());
    }
    Crashlytics.log(Log.DEBUG, TAG, "APP LAUNCHED");

    BusProvider.getBus().register(this);
    sInstance = this;

    RxJavaPlugins.setErrorHandler(this::uncaughtRxException);

    setupMetadataRealm();
    setupFonts();
    initOkHttpClient();
    initPicasso();

    NetworkService networkService = new NetworkService();
    mHACKListener = networkService;
    networkService.start(mOkHttpClient);

    mAnalyticsService = new AnalyticsService(BusProvider.getBus());
    mAnalyticsService.start();
}
 
Example #28
Source File: AnalyticsService.java    From quill with MIT License 5 votes vote down vote up
@Subscribe
public void onLogoutStatusEvent(LogoutStatusEvent logoutEvent) {
    if (logoutEvent.succeeded) {
        Timber.i("LOGOUT SUCCEEDED");
        Answers.getInstance().logCustom(new CustomEvent("Logout"));
    }
}
 
Example #29
Source File: DonateFragment.java    From block-this with GNU General Public License v3.0 5 votes vote down vote up
public void getGames(View v){
    Answers.getInstance().logCustom(new CustomEvent("3.0 Donate").putCustomAttribute("Type", "Game"));
    Fragment fragment = new GameFragment();
    //replacing the fragment
    if (fragment != null) {
        FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
        ft.replace(R.id.content_frame, fragment);
        ft.commit();
    }
}
 
Example #30
Source File: AboutShortcuts.java    From prayer-times-android with Apache License 2.0 5 votes vote down vote up
public static void rate(@NonNull Context ctx) {
    Uri uri = Uri.parse("market://details?id=" + ctx.getPackageName());
    Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
    try {
        ctx.startActivity(goToMarket);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(ctx, "Couldn't launch the market", Toast.LENGTH_LONG).show();
    }

    Answers.getInstance().logCustom(new CustomEvent("About")
            .putCustomAttribute("action", "rate")
    );

    //AppRatingDialog.setInstalltionTime(Long.MAX_VALUE); //never show the rating dialog :)
}