本文整理汇总了Java中com.crashlytics.android.answers.LoginEvent类的典型用法代码示例。如果您正苦于以下问题:Java LoginEvent类的具体用法?Java LoginEvent怎么用?Java LoginEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoginEvent类属于com.crashlytics.android.answers包,在下文中一共展示了LoginEvent类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sendUserProperties
import com.crashlytics.android.answers.LoginEvent; //导入依赖的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
示例2: logLogin
import com.crashlytics.android.answers.LoginEvent; //导入依赖的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
}
}
开发者ID:brevent,项目名称:Brevent,代码行数:17,代码来源:StatsUtils.java
示例3: test_buildAnswersLoginEvent
import com.crashlytics.android.answers.LoginEvent; //导入依赖的package包/类
@Test
public void test_buildAnswersLoginEvent()
{
LoginEvent result = logger.buildAnswersLoginEvent(loginEvent);
Map<String, Object> predefinedAttributes = PackageScopeWrappedCalls.getPredefinedAttributes(result);
assertThat(predefinedAttributes.size()).isEqualTo(2);
assertThat(predefinedAttributes).containsKey(Attributes.LogIn.METHOD);
assertThat(predefinedAttributes).containsKey(Attributes.LogIn.SUCCESS);
Map<String, Object> customAttributes = PackageScopeWrappedCalls.getCustomAttributes(result);
assertThat(customAttributes.size()).isEqualTo(1);
assertThat(customAttributes).containsKey(CUSTOM_KEY);
}
开发者ID:busybusy,项目名称:AnalyticsKit-Android,代码行数:17,代码来源:LoginLoggerTest.java
示例4: setUpSignOut
import com.crashlytics.android.answers.LoginEvent; //导入依赖的package包/类
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();
}
});
}
开发者ID:crashlytics,项目名称:cannonball-android,代码行数:17,代码来源:AboutActivity.java
示例5: setUpTwitterButton
import com.crashlytics.android.answers.LoginEvent; //导入依赖的package包/类
private void setUpTwitterButton() {
twitterButton = (TwitterLoginButton) findViewById(R.id.twitter_button);
twitterButton.setCallback(new Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> result) {
SessionRecorder.recordSessionActive("Login: twitter account active", result.data);
Answers.getInstance().logLogin(new LoginEvent().putMethod("Twitter").putSuccess(true));
startThemeChooser();
}
@Override
public void failure(TwitterException exception) {
Answers.getInstance().logLogin(new LoginEvent().putMethod("Twitter").putSuccess(false));
Toast.makeText(getApplicationContext(),
getResources().getString(R.string.toast_twitter_signin_fail),
Toast.LENGTH_SHORT).show();
Crashlytics.logException(exception);
}
});
}
开发者ID:crashlytics,项目名称:cannonball-android,代码行数:21,代码来源:LoginActivity.java
示例6: setUpDigitsButton
import com.crashlytics.android.answers.LoginEvent; //导入依赖的package包/类
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);
}
});
}
开发者ID:crashlytics,项目名称:cannonball-android,代码行数:22,代码来源:LoginActivity.java
示例7: trackLoginResult
import com.crashlytics.android.answers.LoginEvent; //导入依赖的package包/类
public void trackLoginResult(boolean loginSuccess) {
Bundle bundle = new Bundle();
if (loginSuccess) {
bundle.putString(AppEventsConstants.EVENT_PARAM_VALUE_YES, String.valueOf(loginSuccess));
} else {
bundle.putString(AppEventsConstants.EVENT_PARAM_VALUE_NO, String.valueOf(loginSuccess));
}
logger.logEvent(LOGIN_EVENT, bundle);
answers.logLogin(new LoginEvent().putMethod("Digits").putSuccess(loginSuccess));
}
开发者ID:Mun0n,项目名称:MADBike,代码行数:11,代码来源:AnalyticsManager.java
示例8: logLogin
import com.crashlytics.android.answers.LoginEvent; //导入依赖的package包/类
private static void logLogin(@Nullable String blogUrl, boolean success) {
if (blogUrl == null) {
blogUrl = "Unknown";
}
String successStr = success ? "SUCCEEDED" : "FAILED";
Log.i(TAG, "LOGIN %s, BLOG URL = %s", successStr, blogUrl);
Answers.getInstance().logLogin(new LoginEvent()
.putCustomAttribute("URL", blogUrl)
.putSuccess(success));
}
开发者ID:TryGhost,项目名称:Ghost-Android,代码行数:11,代码来源:AnalyticsService.java
示例9: logSpecificEvent
import com.crashlytics.android.answers.LoginEvent; //导入依赖的package包/类
@Override
public void logSpecificEvent(@NonNull AnalyticsEvent event)
{
LoginEvent loginEvent = buildAnswersLoginEvent(event);
answers.logLogin(loginEvent);
}
开发者ID:busybusy,项目名称:AnalyticsKit-Android,代码行数:8,代码来源:LoginLogger.java
示例10: buildAnswersLoginEvent
import com.crashlytics.android.answers.LoginEvent; //导入依赖的package包/类
/**
* Constructs an Answers consumable event from the given {@code AnalyticsEvent}
*
* @param event the custom event containing data to submit to the Answers framework
* @return the instantiated {@code LoginEvent} object
*/
@NonNull
LoginEvent buildAnswersLoginEvent(@NonNull AnalyticsEvent event)
{
LoginEvent loginEvent = new LoginEvent();
Map<String, Object> attributeMap = event.getAttributes();
if (attributeMap != null)
{
for (String key : attributeMap.keySet())
{
//noinspection IfCanBeSwitch (switch on String doesn't play nice on older devices)
if (key.equals(Attributes.LogIn.METHOD))
{
loginEvent.putMethod(attributeMap.get(key).toString());
}
else if (key.equals(Attributes.LogIn.SUCCESS))
{
loginEvent.putSuccess((Boolean) attributeMap.get(key));
}
else
{
loginEvent.putCustomAttribute(key, attributeMap.get(key).toString());
}
}
}
return loginEvent;
}
开发者ID:busybusy,项目名称:AnalyticsKit-Android,代码行数:35,代码来源:LoginLogger.java
示例11: eventLogin
import com.crashlytics.android.answers.LoginEvent; //导入依赖的package包/类
public static void eventLogin(String method, Boolean isLoginSucceeded, Integer responseCode) {
Answers.getInstance().logLogin(new LoginEvent()
.putMethod(method)
.putSuccess(isLoginSucceeded)
.putCustomAttribute("responseCode", responseCode)
);
}
开发者ID:triplepy,项目名称:sh8email-android,代码行数:8,代码来源:LogAppEventUtil.java
示例12: logLogin
import com.crashlytics.android.answers.LoginEvent; //导入依赖的package包/类
private static void logLogin(@Nullable String blogUrl, boolean success) {
if (blogUrl == null) {
blogUrl = "Unknown";
}
String successStr = success ? "SUCCEEDED" : "FAILED";
Timber.i("LOGIN " + successStr + ", BLOG URL = " + blogUrl);
Answers.getInstance().logLogin(new LoginEvent()
.putCustomAttribute("URL", blogUrl)
.putSuccess(success));
}
开发者ID:vickychijwani,项目名称:quill,代码行数:11,代码来源:AnalyticsService.java
示例13: sendLogIn
import com.crashlytics.android.answers.LoginEvent; //导入依赖的package包/类
public void sendLogIn(final JSONArray data, final CallbackContext context) {
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
LoginEvent evt = new LoginEvent();
Answers.getInstance()
.logLogin(evt);
}
});
}
开发者ID:napolitano,项目名称:cordova-plugin-answers,代码行数:11,代码来源:AnswersPlugin.java
示例14: onResponse
import com.crashlytics.android.answers.LoginEvent; //导入依赖的package包/类
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
showProgress(false);
try {
String json = response.body().string();
if (json.contains("{\"error\":")) {
userEditText.setError(json.split(":\"")[1].split("\"")[0]);
userEditText.requestFocus();
Answers.getInstance().logLogin(new LoginEvent()
.putMethod("Username")
.putSuccess(false)
.putCustomAttribute("Error", json));
} else {
/*
* {"user":"name","session":"sessionstring"} -> sessionstring
*/
Answers.getInstance().logLogin(new LoginEvent()
.putMethod("Username")
.putSuccess(true));
SyncBroadcastReceiver.scheduleNextSync(this);
String[] data = json.split(",");
String session = data[1].split(":")[1].replace("\"", "").replace("}", "").trim();
String user = data[0].split(":")[1].replace("\"", "").replace("}", "").trim();
Settings.of(this).raw().edit()
.putString("pref_session", session)
.putString("pref_user", user)
.commit();
getApplicationContext().deleteDatabase(MainDBHelper.DATABASE_NAME);
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
} catch (IOException e) {
e.printStackTrace();
Crashlytics.log(Log.ERROR, "LOGIN", "Error while login: " + e.toString());
Crashlytics.logException(e);
}
}
开发者ID:M4lik,项目名称:burning-series,代码行数:44,代码来源:LoginActivity.java
注:本文中的com.crashlytics.android.answers.LoginEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论