@Test public void testSetAttributes() throws NoSuchFieldException, IllegalAccessException, InterruptedException { HashMap<String, Object> attrs = new HashMap<>(); attrs.put("key", 1); attrs.put("key_2", "value"); lqd.setUserAttributes(attrs); Field f = Liquid.class.getDeclaredField("mCurrentUser"); f.setAccessible(true); LQUser user = ((LQUser) f.get(lqd)); Thread.sleep(2000); assertEquals(1, user.attributeForKey("key")); assertEquals("value", user.attributeForKey("key_2")); }
public void setUserAttributes(final Map<String, Object> attributes) { mQueue.execute(new Runnable() { @Override public void run() { for (String key : attributes.keySet()) { if (LQModel.validKey(key, isDevelopmentMode)) { mCurrentUser.setAttribute(key, attributes.get(key)); } } mCurrentUser.save(mContext, mApiToken); } }); }
Liquid { public void setUserAttributes(final Map<String, Object> attributes) { mQueue.execute(new Runnable() { @Override public void run() { for (String key : attributes.keySet()) { if (LQModel.validKey(key, isDevelopmentMode)) { mCurrentUser.setAttribute(key, attributes.get(key)); } } mCurrentUser.save(mContext, mApiToken); } }); } }
Liquid { public void setUserAttributes(final Map<String, Object> attributes) { mQueue.execute(new Runnable() { @Override public void run() { for (String key : attributes.keySet()) { if (LQModel.validKey(key, isDevelopmentMode)) { mCurrentUser.setAttribute(key, attributes.get(key)); } } mCurrentUser.save(mContext, mApiToken); } }); } private  Liquid(Context context, String apiToken, boolean developmentMode); }
Liquid { public void setUserAttributes(final Map<String, Object> attributes) { mQueue.execute(new Runnable() { @Override public void run() { for (String key : attributes.keySet()) { if (LQModel.validKey(key, isDevelopmentMode)) { mCurrentUser.setAttribute(key, attributes.get(key)); } } mCurrentUser.save(mContext, mApiToken); } }); } private  Liquid(Context context, String apiToken, boolean developmentMode); static Liquid getInstance(); static Liquid initialize(Context context, String apiToken); static Liquid initialize(Context context, String apiToken, boolean developmentMode); static boolean isInitialized(); void attachLiquidEventListener(LiquidOnEventListener l); void detachLiquidEventListener(LiquidOnEventListener l); boolean willAutoloadVariables(); void setAutoLoadVariables(boolean autoloadVariables); int getSessionTimeout(); void setSessionTimeout(int sessionTimeout); void setFlushInterval(int flushInterval); int getFlushInterval(); void setupPushNotifications(Activity activity, final String senderID); void alias(); void resetUser(); void identifyUser(String identifier); void identifyUser(String identifier, boolean alias); void identifyUser(String identifier, Map<String, Object> attributes); void identifyUser(String identifier, Map<String, Object> attributes, boolean alias); String getUserIdentifier(); String getDeviceIdentifier(); void setUserAttribute(String key, Object attribute); void setUserAttributes(final Map<String, Object> attributes); void setCurrentLocation(final Location location); void setGCMregistrationID(final String id); void removeGCMregistrationID(); void track(String eventName); void track(String eventName, Map<String, Object> attributes); void trackDismiss(final LQInAppMessage inAppMessage); void trackCta(final LQInAppMessage.Cta inAppMessageCta); void activityResumed(Activity activity); void activityPaused(Activity activity); void activityStopped(Activity activity); void activityStarted(Activity activity); void activityDestroyed(Activity activity); void activityCreated(Activity activity); void requestValues(); void addInapp(LQInAppMessage inapp); void showInAppMessages(); void loadValues(); Date getDateVariable(String variableKey, Date fallbackValue); int getColorVariable(String variableKey, int fallbackValue); String getStringVariable(String variableKey, String fallbackValue); int getIntVariable(String variableKey, int fallbackValue); float getFloatVariable(String variableKey, float fallbackValue); boolean getBooleanVariable(String variableKey, boolean fallbackValue); void flush(); void reset(); void softReset(); }
Liquid { public void setUserAttributes(final Map<String, Object> attributes) { mQueue.execute(new Runnable() { @Override public void run() { for (String key : attributes.keySet()) { if (LQModel.validKey(key, isDevelopmentMode)) { mCurrentUser.setAttribute(key, attributes.get(key)); } } mCurrentUser.save(mContext, mApiToken); } }); } private  Liquid(Context context, String apiToken, boolean developmentMode); static Liquid getInstance(); static Liquid initialize(Context context, String apiToken); static Liquid initialize(Context context, String apiToken, boolean developmentMode); static boolean isInitialized(); void attachLiquidEventListener(LiquidOnEventListener l); void detachLiquidEventListener(LiquidOnEventListener l); boolean willAutoloadVariables(); void setAutoLoadVariables(boolean autoloadVariables); int getSessionTimeout(); void setSessionTimeout(int sessionTimeout); void setFlushInterval(int flushInterval); int getFlushInterval(); void setupPushNotifications(Activity activity, final String senderID); void alias(); void resetUser(); void identifyUser(String identifier); void identifyUser(String identifier, boolean alias); void identifyUser(String identifier, Map<String, Object> attributes); void identifyUser(String identifier, Map<String, Object> attributes, boolean alias); String getUserIdentifier(); String getDeviceIdentifier(); void setUserAttribute(String key, Object attribute); void setUserAttributes(final Map<String, Object> attributes); void setCurrentLocation(final Location location); void setGCMregistrationID(final String id); void removeGCMregistrationID(); void track(String eventName); void track(String eventName, Map<String, Object> attributes); void trackDismiss(final LQInAppMessage inAppMessage); void trackCta(final LQInAppMessage.Cta inAppMessageCta); void activityResumed(Activity activity); void activityPaused(Activity activity); void activityStopped(Activity activity); void activityStarted(Activity activity); void activityDestroyed(Activity activity); void activityCreated(Activity activity); void requestValues(); void addInapp(LQInAppMessage inapp); void showInAppMessages(); void loadValues(); Date getDateVariable(String variableKey, Date fallbackValue); int getColorVariable(String variableKey, int fallbackValue); String getStringVariable(String variableKey, String fallbackValue); int getIntVariable(String variableKey, int fallbackValue); float getFloatVariable(String variableKey, float fallbackValue); boolean getBooleanVariable(String variableKey, boolean fallbackValue); void flush(); void reset(); void softReset(); static final String LIQUID_VERSION; }