當前位置: 首頁>>代碼示例>>Java>>正文


Java CustomEvent類代碼示例

本文整理匯總了Java中com.crashlytics.android.answers.CustomEvent的典型用法代碼示例。如果您正苦於以下問題:Java CustomEvent類的具體用法?Java CustomEvent怎麽用?Java CustomEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CustomEvent類屬於com.crashlytics.android.answers包,在下文中一共展示了CustomEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: eventCalculate

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
public static void eventCalculate(Context context,Course course, double grade){
    //Fabric
    Answers.getInstance().logCustom(new CustomEvent(AnalyticsConstants.EVENT_CALCULATION)
            .putCustomAttribute("Course name", course.getName())
            .putCustomAttribute("Course code", course.getCode())
            .putCustomAttribute("Result", grade));

    //Firebase
    Bundle params = new Bundle();
    params.putString("course_name",course.getName());
    params.putString("course_code",course.getCode());
    params.putDouble("result",grade);
    FirebaseAnalytics.getInstance(context).logEvent(AnalyticsConstants.EVENT_CALCULATION,params);

    //Amplitude
    try {
        Amplitude.getInstance().logEvent(AnalyticsConstants.EVENT_CALCULATION, new JSONObject()
                .put("Course name",course.getName())
                .put("Course code",course.getCode())
                .put("Result",grade));
    } catch (JSONException e) {
        Crashlytics.logException(e);
    }

}
 
開發者ID:Bruno125,項目名稱:Unofficial-Ups,代碼行數:26,代碼來源:AnalyticsManager.java

示例2: eventReserve

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
public static void eventReserve(String resourceType, String venue, int hourOfDay){
    //Fabric
    Answers.getInstance().logCustom(new CustomEvent(AnalyticsConstants.EVENT_RESERVE)
            .putCustomAttribute("Resource Type", resourceType)
            .putCustomAttribute("Venue", venue)
            .putCustomAttribute("Hour", hourOfDay));
    //Amplitude
    try {
        Amplitude.getInstance().logEvent(AnalyticsConstants.EVENT_RESERVE, new JSONObject()
                .put("Resource Type",resourceType)
                .put("Venue",venue)
                .put("Hour",hourOfDay));
    } catch (JSONException e) {
        Crashlytics.logException(e);
    }
}
 
開發者ID:Bruno125,項目名稱:Unofficial-Ups,代碼行數:17,代碼來源:AnalyticsManager.java

示例3: eventUpdated

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
public static void eventUpdated(Context context, int fromVersion, int toVersion){
    //Fabric
    Answers.getInstance().logCustom(new CustomEvent(AnalyticsConstants.EVENT_UPDATE)
            .putCustomAttribute("From Version", fromVersion)
            .putCustomAttribute("To Version", toVersion));

    //Firebase
    Bundle params = new Bundle();
    params.putInt("from_version",fromVersion);
    params.putInt("to_version",toVersion);
    FirebaseAnalytics.getInstance(context).logEvent(AnalyticsConstants.EVENT_UPDATE,params);

    //Amplitude
    try {
        Amplitude.getInstance().logEvent(AnalyticsConstants.EVENT_UPDATE, new JSONObject()
                .put("From Version",fromVersion)
                .put("To Version",toVersion));
    } catch (JSONException e) {
        Crashlytics.logException(e);
    }

}
 
開發者ID:Bruno125,項目名稱:Unofficial-Ups,代碼行數:23,代碼來源:AnalyticsManager.java

示例4: sendUserProperties

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
@Override
public void sendUserProperties(String name, String value) {
    switch (name) {
        case AnalyticConstant.USER_EMAIL:
            Crashlytics.setUserEmail(value);
            break;
        case AnalyticConstant.USER_NAME:
            Crashlytics.setUserName(value);
            break;
        case AnalyticConstant.USER_SIGN_IN:
            Answers.getInstance().logLogin(new LoginEvent().putMethod(value).putSuccess(true));
            break;
        case AnalyticConstant.USER_SIGN_UP:
            Answers.getInstance().logSignUp(new SignUpEvent().putMethod(value).putSuccess(true));
            break;
        default:
            Answers.getInstance().logCustom(new CustomEvent("Custom_Event").putCustomAttribute(name, value));
            break;
    }

}
 
開發者ID:afiqiqmal,項目名稱:My-Android-Base-Code,代碼行數:22,代碼來源:CrashLyticManager.java

示例5: afterPayment

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
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();
        }
    });
}
 
開發者ID:Rai220,項目名稱:Telephoto,代碼行數:21,代碼來源:BuyActivity.java

示例6: onCreate

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_log_in_to_ttn);

    clientId = getString(R.string.oauth_client_id);
    clientSecret = getString(R.string.oauth_client_secret);
    redirectURI = getString(R.string.oauth_redirect_url);

    service = new ServiceBuilder()
            .apiKey(clientId)
            .apiSecret(clientSecret)
            .state(secretState)
            .callback(redirectURI)
            .build(TheThingsNetworkOathApi.instance());

    MyApplication mApplication = (MyApplication)getApplicationContext();
    mApplication.ttnApplications = new ArrayList<>();
    mApplication.chosenTtnApplication = null;

    Answers.getInstance().logCustom(new CustomEvent("Device configure").putCustomAttribute("method", "oauth2"));

    loadLoginPage();
}
 
開發者ID:jpmeijers,項目名稱:ttnmapper_android_v2,代碼行數:25,代碼來源:LogInToTTN.java

示例7: onItemClick

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
    String selectedDevice = (String) adapterView.getAdapter().getItem(i);
    MyApplication mApplication = (MyApplication)getApplicationContext();

    mApplication.setTtnDeviceId(selectedDevice);
    if (selectedDevice.equals("+")) {
        Answers.getInstance().logCustom(new CustomEvent("Levices")
                .putCustomAttribute("all devices", "" + true));
    } else {
        Answers.getInstance().logCustom(new CustomEvent("Levices")
                .putCustomAttribute("all devices", "" + false));
    }

    mApplication.ttnApplications.clear(); //free some memory
    finish();
}
 
開發者ID:jpmeijers,項目名稱:ttnmapper_android_v2,代碼行數:18,代碼來源:DevicesList.java

示例8: onActivityResult

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
@Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
    if (resultCode == Activity.RESULT_OK && requestCode == 5) {
        Uri uri = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);

        SharedPreferences myPrefs = this.getSharedPreferences(SettingConstants.PREFERENCES, MODE_PRIVATE);
        SharedPreferences.Editor prefsEditor = myPrefs.edit();
        if (uri != null) {
            prefsEditor.putString(SettingConstants.SOUNDFILE, uri.toString());
            prefsEditor.apply();
            Log.d(TAG, "Chosen sound: " + uri.toString());

            Answers.getInstance().logCustom(new CustomEvent("Sound")
                    .putCustomAttribute("uri", uri.toString()));
        } else {
            prefsEditor.putString(SettingConstants.SOUNDFILE, "");
            prefsEditor.apply();
        }
        TextView soundTV = (TextView) findViewById(R.id.textViewCurrentSound);
        soundTV.setText(myPrefs.getString(SettingConstants.SOUNDFILE, SettingConstants.SOUNDFILE_DEFAULT));
    }
}
 
開發者ID:jpmeijers,項目名稱:ttnmapper_android_v2,代碼行數:23,代碼來源:SettingsActivity.java

示例9: onToggleScreen

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
public void onToggleScreen(View v) {
    com.github.clans.fab.FloatingActionButton floatingActionButton = (com.github.clans.fab.FloatingActionButton) findViewById(R.id.fabItemScreenOn);
    SharedPreferences myPrefs = this.getSharedPreferences(SettingConstants.PREFERENCES, MODE_PRIVATE);
    boolean previousState = myPrefs.getBoolean(SettingConstants.KEEP_SCREEN_ON, SettingConstants.KEEP_SCREEN_ON_DEFAULT);

    SharedPreferences.Editor prefsEditor = myPrefs.edit();
    prefsEditor.putBoolean(SettingConstants.KEEP_SCREEN_ON, !previousState);
    prefsEditor.apply();

    if (previousState) {
        floatingActionButton.setColorNormalResId(R.color.fab_disabled);
        floatingActionButton.setColorPressedResId(R.color.fab_disabled_pressed);

        //It was on, now off
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    } else {
        floatingActionButton.setColorNormalResId(R.color.fab_green_dark);
        floatingActionButton.setColorPressedResId(R.color.fab_green_light);

        //It was off, now on
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }

    Answers.getInstance().logCustom(new CustomEvent(SettingConstants.KEEP_SCREEN_ON)
            .putCustomAttribute("on", "" + !previousState));
}
 
開發者ID:jpmeijers,項目名稱:ttnmapper_android_v2,代碼行數:27,代碼來源:MapsActivity.java

示例10: onToggleAutoCenter

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
public void onToggleAutoCenter(View v) {
    com.github.clans.fab.FloatingActionButton floatingActionButton = (com.github.clans.fab.FloatingActionButton) findViewById(R.id.fabItemAutoCenter);
    SharedPreferences myPrefs = this.getSharedPreferences(SettingConstants.PREFERENCES, MODE_PRIVATE);
    boolean previousState = myPrefs.getBoolean(SettingConstants.AUTO_CENTER, SettingConstants.AUTO_CENTER_DEFAULT);

    SharedPreferences.Editor prefsEditor = myPrefs.edit();
    prefsEditor.putBoolean(SettingConstants.AUTO_CENTER, !previousState);
    prefsEditor.apply();

    if (previousState) {
        floatingActionButton.setColorNormalResId(R.color.fab_disabled);
        floatingActionButton.setColorPressedResId(R.color.fab_disabled_pressed);

        //It's off now, do nothing
    } else {
        floatingActionButton.setColorNormalResId(R.color.fab_green_dark);
        floatingActionButton.setColorPressedResId(R.color.fab_green_light);

        autoCenterMap();
    }

    Answers.getInstance().logCustom(new CustomEvent(SettingConstants.AUTO_CENTER)
            .putCustomAttribute("on", "" + !previousState));
}
 
開發者ID:jpmeijers,項目名稱:ttnmapper_android_v2,代碼行數:25,代碼來源:MapsActivity.java

示例11: onToggleAutoZoom

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
public void onToggleAutoZoom(View v) {
    com.github.clans.fab.FloatingActionButton floatingActionButton = (com.github.clans.fab.FloatingActionButton) findViewById(R.id.fabItemAutoZoom);
    SharedPreferences myPrefs = this.getSharedPreferences(SettingConstants.PREFERENCES, MODE_PRIVATE);
    boolean previousState = myPrefs.getBoolean(SettingConstants.AUTO_ZOOM, SettingConstants.AUTO_ZOOM_DEFAULT);

    SharedPreferences.Editor prefsEditor = myPrefs.edit();
    prefsEditor.putBoolean(SettingConstants.AUTO_ZOOM, !previousState);
    prefsEditor.apply();

    if (previousState) {
        floatingActionButton.setColorNormalResId(R.color.fab_disabled);
        floatingActionButton.setColorPressedResId(R.color.fab_disabled_pressed);

        //It's off now, do nothing
    } else {
        floatingActionButton.setColorNormalResId(R.color.fab_green_dark);
        floatingActionButton.setColorPressedResId(R.color.fab_green_light);

        autoZoomMap();
    }

    Answers.getInstance().logCustom(new CustomEvent(SettingConstants.AUTO_ZOOM)
            .putCustomAttribute("on", "" + !previousState));
}
 
開發者ID:jpmeijers,項目名稱:ttnmapper_android_v2,代碼行數:25,代碼來源:MapsActivity.java

示例12: onToggleLordrive

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
public void onToggleLordrive(View v) {
    com.github.clans.fab.FloatingActionButton floatingActionButton = (com.github.clans.fab.FloatingActionButton) findViewById(R.id.fabItemLordrive);
    SharedPreferences myPrefs = this.getSharedPreferences(SettingConstants.PREFERENCES, MODE_PRIVATE);
    boolean previousState = myPrefs.getBoolean(SettingConstants.LORDRIVE, SettingConstants.LORDRIVE_DEFAULT);

    SharedPreferences.Editor prefsEditor = myPrefs.edit();
    prefsEditor.putBoolean(SettingConstants.LORDRIVE, !previousState);
    prefsEditor.apply();

    if (previousState) {
        floatingActionButton.setColorNormalResId(R.color.fab_disabled);
        floatingActionButton.setColorPressedResId(R.color.fab_disabled_pressed);

        clearAndReaddAllToMap();
    } else {
        floatingActionButton.setColorNormalResId(R.color.fab_green_dark);
        floatingActionButton.setColorPressedResId(R.color.fab_green_light);

        clearAndReaddAllToMap();
    }

    Answers.getInstance().logCustom(new CustomEvent(SettingConstants.LORDRIVE)
            .putCustomAttribute("on", "" + !previousState));
}
 
開發者ID:jpmeijers,項目名稱:ttnmapper_android_v2,代碼行數:25,代碼來源:MapsActivity.java

示例13: startMainService

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
private void startMainService() {
    Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "MainService start chain");
    if (checkPlayServicesPrereq() && hasAcceptedTerms() && requestLocationPermission() && checkGPSPrereq() && checkNetworkPrereq()) {
        styleStartStopButton(true);
        reset.setVisibility(View.INVISIBLE);

        startService(new Intent(this, MainService.class));
        bindService(new Intent(this, MainService.class), mainServiceConn, BIND_AUTO_CREATE);
        driveTimeHandler.postDelayed(driveTimeRunnable, DRIVE_TIME_REFRESH_FREQ);

        Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "MainService started");
        Answers.getInstance().logCustom(new CustomEvent(useHereMaps ? "Using HERE" : "Using Overpass"));
        Answers.getInstance().logCustom(new CustomEvent(Prefs.isUseKph(this) ? "Using kph" : "Using mph"));
    } else {
        Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "MainService not started");
    }
}
 
開發者ID:jakehilborn,項目名稱:speedr,代碼行數:18,代碼來源:MainActivity.java

示例14: checkPlayServicesPrereq

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
private boolean checkPlayServicesPrereq() {
    GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
    int result = googleAPI.isGooglePlayServicesAvailable(this);
    if (result != ConnectionResult.SUCCESS) {
        if (googleAPI.isUserResolvableError(result)) {
            googleAPI.getErrorDialog(this, result, 0).show();

            Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "PlayServices update required");
            Answers.getInstance().logCustom(new CustomEvent("PlayServices update required"));
        } else {
            playServicesErrorToast.show();

            Crashlytics.log(Log.ERROR, MainActivity.class.getSimpleName(), "PlayServices incompatible");
            Answers.getInstance().logCustom(new CustomEvent("PlayServices incompatible"));
        }
        return false;
    }

    Crashlytics.log(Log.INFO, MainActivity.class.getSimpleName(), "PlayServices compatible");
    return true;
}
 
開發者ID:jakehilborn,項目名稱:speedr,代碼行數:22,代碼來源:MainActivity.java

示例15: newHereCredentials

import com.crashlytics.android.answers.CustomEvent; //導入依賴的package包/類
private boolean newHereCredentials() {
    if (appIdField.getText().toString().trim().length() < APP_ID_LENGTH) {
        return false;
    }
    if (appCodeField.getText().toString().trim().length() < APP_CODE_LENGTH) {
        return false;
    }
    if (appIdField.getText().toString().trim().equals(Prefs.getHereAppId(this)) &&
            appCodeField.getText().toString().trim().equals(Prefs.getHereAppCode(this))) {
        return false;
    }
    if (Prefs.isUseHereMaps(this)) {
        return false;
    }

    limitProviderSelectorHandler(true);
    Toast.makeText(this, R.string.enabled_here_maps_toast, Toast.LENGTH_LONG).show();

    Answers.getInstance().logCustom(new CustomEvent("Auto enabled HERE"));

    return true;
}
 
開發者ID:jakehilborn,項目名稱:speedr,代碼行數:23,代碼來源:SettingsActivity.java


注:本文中的com.crashlytics.android.answers.CustomEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。