本文整理汇总了Java中com.crashlytics.android.answers.Answers类的典型用法代码示例。如果您正苦于以下问题:Java Answers类的具体用法?Java Answers怎么用?Java Answers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Answers类属于com.crashlytics.android.answers包,在下文中一共展示了Answers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: eventLogin
import com.crashlytics.android.answers.Answers; //导入依赖的package包/类
public static void eventLogin(Context context,boolean success){
//Fabric
Answers.getInstance().logSignUp(new SignUpEvent()
.putMethod("Normal")
.putSuccess(success));
//Firebase
Bundle params = new Bundle();
params.putBoolean("Success",success);
FirebaseAnalytics.getInstance(context).logEvent(AnalyticsConstants.EVENT_LOGIN,params);
//Amplitude
try {
Amplitude.getInstance().logEvent(AnalyticsConstants.EVENT_LOGIN,new JSONObject().put("Success",success));
} catch (JSONException e) {
Crashlytics.logException(e);
}
}
示例2: eventCalculate
import com.crashlytics.android.answers.Answers; //导入依赖的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);
}
}
示例3: eventReserve
import com.crashlytics.android.answers.Answers; //导入依赖的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);
}
}
示例4: eventUpdated
import com.crashlytics.android.answers.Answers; //导入依赖的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);
}
}
示例5: sendUserProperties
import com.crashlytics.android.answers.Answers; //导入依赖的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;
}
}
示例6: build
import com.crashlytics.android.answers.Answers; //导入依赖的package包/类
public Crashlytics build() {
if (this.coreBuilder != null) {
if (this.core != null) {
throw new IllegalStateException("Must not use Deprecated methods delay(), disabled(), listener(), pinningInfoProvider() with core()");
}
this.core = this.coreBuilder.build();
}
if (this.answers == null) {
this.answers = new Answers();
}
if (this.beta == null) {
this.beta = new Beta();
}
if (this.core == null) {
this.core = new CrashlyticsCore();
}
return new Crashlytics(this.answers, this.beta, this.core);
}
示例7: onCreate
import com.crashlytics.android.answers.Answers; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
TallyStackerApplication.instance = this;
JodaTimeAndroid.init(this);
Fabric.with(this, new Crashlytics());
Fabric.with(this, new Answers());
Stetho.initializeWithDefaults(this);
// Setup handler for uncaught exceptions.
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable e) {
if (!(e instanceof ExpectedElementNotFound))
handleUncaughtException(e);
}
});
}
示例8: logInvite
import com.crashlytics.android.answers.Answers; //导入依赖的package包/类
public static void logInvite(Map<String, Object> attributes) {
try {
InviteEvent inviteEvent = new InviteEvent();
for (Map.Entry<String, Object> entry : attributes.entrySet()) {
Object value = entry.getValue();
if (value instanceof String) {
inviteEvent.putCustomAttribute(entry.getKey(), (String) value);
} else if (value instanceof Number) {
inviteEvent.putCustomAttribute(entry.getKey(), (Number) value);
}
}
Answers.getInstance().logInvite(inviteEvent);
} catch (IllegalStateException e) { // NOSONAR
// do nothing
}
}
示例9: logLogin
import com.crashlytics.android.answers.Answers; //导入依赖的package包/类
public static void logLogin(Map<String, Object> attributes) {
try {
LoginEvent loginEvent = new LoginEvent();
for (Map.Entry<String, Object> entry : attributes.entrySet()) {
Object value = entry.getValue();
if (value instanceof String) {
loginEvent.putCustomAttribute(entry.getKey(), (String) value);
} else if (value instanceof Number) {
loginEvent.putCustomAttribute(entry.getKey(), (Number) value);
}
}
Answers.getInstance().logLogin(loginEvent);
} catch (IllegalStateException e) { // NOSONAR
// do nothing
}
}
示例10: afterPayment
import com.crashlytics.android.answers.Answers; //导入依赖的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();
}
});
}
示例11: onCreate
import com.crashlytics.android.answers.Answers; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics(), new Answers());
Log.useEnvironment(BuildConfig.DEBUG ? Log.Environment.DEBUG : Log.Environment.RELEASE);
Log.i(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();
}
示例12: onCreate
import com.crashlytics.android.answers.Answers; //导入依赖的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();
}
示例13: onItemClick
import com.crashlytics.android.answers.Answers; //导入依赖的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();
}
示例14: onActivityResult
import com.crashlytics.android.answers.Answers; //导入依赖的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));
}
}
示例15: onToggleScreen
import com.crashlytics.android.answers.Answers; //导入依赖的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));
}