本文整理匯總了Java中com.crashlytics.android.answers.CustomEvent.putCustomAttribute方法的典型用法代碼示例。如果您正苦於以下問題:Java CustomEvent.putCustomAttribute方法的具體用法?Java CustomEvent.putCustomAttribute怎麽用?Java CustomEvent.putCustomAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.crashlytics.android.answers.CustomEvent
的用法示例。
在下文中一共展示了CustomEvent.putCustomAttribute方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: track
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
public static void track(String event_name, HashMap<String, ?> values){
FirebaseAuth ssFirebaseAuth = FirebaseAuth.getInstance();
FirebaseUser ssUser = ssFirebaseAuth.getCurrentUser();
CustomEvent newEvent = new CustomEvent(event_name);
if (ssUser != null && ssUser.getDisplayName() != null){
newEvent.putCustomAttribute(SSConstants.SS_EVENT_PARAM_USER_ID, ssUser.getUid());
newEvent.putCustomAttribute(SSConstants.SS_EVENT_PARAM_USER_NAME, ssUser.getDisplayName());
} else {
newEvent.putCustomAttribute(SSConstants.SS_EVENT_PARAM_USER_NAME, "Anonymous");
}
for (Map.Entry<String, ?> entry : values.entrySet()) {
if (entry.getValue() instanceof Integer){
newEvent.putCustomAttribute(entry.getKey(), (Integer)entry.getValue());
} else {
newEvent.putCustomAttribute(entry.getKey(), (String)entry.getValue());
}
}
Answers.getInstance().logCustom(newEvent);
}
示例2: sendEvent
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
@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);
}
示例3: buildCustomAnswersEvent
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的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 CustomEvent} object
*/
CustomEvent buildCustomAnswersEvent(@NonNull AnalyticsEvent event)
{
CustomEvent customEvent = new CustomEvent(event.name());
Map<String, Object> attributeMap = event.getAttributes();
// convert the attributes to to <String, String> to appease the Answers API
if (attributeMap != null)
{
for (String key : attributeMap.keySet())
{
customEvent.putCustomAttribute(key, attributeMap.get(key).toString());
}
}
return customEvent;
}
示例4: onFileRead
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
@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);
}
}
示例5: logPostAction
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
private static void logPostAction(@NonNull String postAction, @Nullable String postUrl) {
CustomEvent postStatsEvent = new CustomEvent("Post Actions")
.putCustomAttribute("Scenario", postAction);
if (postUrl != null) {
// FIXME this is a huge hack, also Fabric only shows 10 of these per day
postStatsEvent.putCustomAttribute("URL", postUrl);
}
Log.i(TAG, "POST ACTION: %s", postAction);
Answers.getInstance().logCustom(postStatsEvent);
}
示例6: reportEvent
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
/**
* Reports an event
*
* @param action Action to report
**/
protected void reportEvent(String action) {
CustomEvent event = new CustomEvent(action);
event.putCustomAttribute(SCREEN, mScreenName);
reportEvent(event);
Timber.d("Fabric Analytics Event tracked: %s - %s", mScreenName, action);
}
示例7: send
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
@Override public void send() {
CustomEvent customEvent = new CustomEvent(name);
if (data != null && !data.isEmpty()) {
Set<Map.Entry<String, String>> dataEntry = data.entrySet();
for (Map.Entry<String, String> attribute : dataEntry) {
customEvent.putCustomAttribute(attribute.getKey(), attribute.getValue());
}
}
fabric.logCustom(customEvent);
}
示例8: logFabricEvent
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
private static void logFabricEvent(String event, Map<String, String> map, int flags) {
if (checkAcceptability(flags, FABRIC)) {
CustomEvent customEvent = new CustomEvent(event);
for (Map.Entry<String, String> entry : map.entrySet()) {
customEvent.putCustomAttribute(entry.getKey(), entry.getValue());
}
Answers.getInstance()
.logCustom(customEvent);
Logger.d(TAG, "Fabric Event: " + event + ", Map: " + map);
}
}
示例9: logPostAction
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
private static void logPostAction(@NonNull String postAction, @Nullable String postUrl) {
CustomEvent postStatsEvent = new CustomEvent("Post Actions")
.putCustomAttribute("Scenario", postAction);
if (postUrl != null) {
// FIXME this is a huge hack, also Fabric only shows 10 of these per day
postStatsEvent.putCustomAttribute("URL", postUrl);
}
Timber.i("POST ACTION: " + postAction);
Answers.getInstance().logCustom(postStatsEvent);
}
示例10: trackEvent
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
public void trackEvent(String eventName, String key, String value){
//truncate value to 100 chars
if(value.length() > 100) {
value = value.substring(0, 99);
}
CustomEvent customEvent = new CustomEvent(eventName);
customEvent.putCustomAttribute(key, value);
Answers.getInstance().logCustom(customEvent);
}
示例11: log
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
@Override
public void log(String eventName, Map<String, String> attributes) {
CustomEvent event = new CustomEvent(eventName);
attributes = attributes == null ? new HashMap<String, String>() : attributes;
for (String attributeKey : attributes.keySet()) {
event.putCustomAttribute(attributeKey, attributes.get(attributeKey));
}
Answers.getInstance().logCustom(event);
}
示例12: event
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
/**
* Logs event happened. This will be used to see statistics
*/
public static void event(@EventType String type, Object... args) {
Timber.i("Event: " + type + " " + Arrays.toString(args));
if (!ENABLED) return;
CustomEvent customEvent = new CustomEvent(type);
for (int i = 0; i < getEvenLength(type, args); i+=2) {
customEvent.putCustomAttribute(args[i].toString(), args[i + 1].toString());
}
Answers.getInstance().logCustom(customEvent);
}
示例13: letsGetItStarted
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
private void letsGetItStarted() {
Utils.startTaskerService(mainActivity);
DeviceConfig deviceConfig = DeviceConfig.get();
if (deviceConfig.dcFirstStart) {
deviceConfig.dcFirstStart = false;
deviceConfig.save();
final boolean isXposedInstalled = AppHelper.isPackageInstalled(XPOSED_INSTALLER_PACAKGE);
final CustomEvent customEvent = new CustomEvent("first_start");
customEvent.putCustomAttribute("xposed_installed", isXposedInstalled ? "true" : "false");
Answers.getInstance().logCustom(customEvent);
}
// patch sepolicy
if (hasRootGranted) {
Utils.patchSEPolicy(mainActivity);
}
for (final Dialog dialog : dialogs) {
if (dialog != null) {
dialog.show();
}
}
permissionDialog = showPermissionDialog(mainActivity);
if (permissionDialog == null && mPostExecuteHook != null) {
mainActivity.runOnUiThread(mPostExecuteHook);
}
}
示例14: buildCustomEvent
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
/**
* Tracks an event
*
* @param action Action to track
**/
protected CustomEvent buildCustomEvent(String action) {
CustomEvent event = new CustomEvent(action);
event.putCustomAttribute(SCREEN, mScreenName);
return event;
}
示例15: onTouchEvent
import com.crashlytics.android.answers.CustomEvent; //導入方法依賴的package包/類
private boolean onTouchEvent(int action, float x, float y, long timestamp) {
if (action == MotionEvent.ACTION_DOWN) {
listener.onDown();
setStart(x, y, timestamp);
return true;
}
if (action == MotionEvent.ACTION_MOVE) {
listener.onMove(x, y);
mostRecentX = x;
mostRecentY = y;
return true;
}
if (action != MotionEvent.ACTION_UP) {
// We ignore non-up events
Timber.i("Ignoring event with action type: %d", action);
return false;
}
listener.onUp();
CustomEvent touchMetadata = new CustomEvent(TOUCH_EVENT);
touchMetadata.putCustomAttribute(
"Horizontal distance (mm)", Math.abs(x - startX) / displayMetrics.xdpi * 25.4f);
touchMetadata.putCustomAttribute(
"Vertical distance (mm)", Math.abs(y - startY) / displayMetrics.ydpi * 25.4f);
LoggingUtils.logCustom(touchMetadata);
if (handleTapEnd(x, y, timestamp)) {
return true;
}
if (handleSwipeEnd(x, y)) {
return true;
}
if (handleLongPressEnd(x, y)) {
return true;
}
// Gesture ended but we don't know how
Timber.w(new RuntimeException("Gesture ended but we don't know how"),
"start=(%f, %f) mostRecent=(%f, %f), age=%dms, reps=%d, isLongPressing=%b",
startX, startY,
mostRecentX, mostRecentY,
timestamp - startTime,
repetitions,
isLongPressing);
resetStart();
return false;
}