@ SuppressWarnings ( "unused" ) public static void setUserId ( String userId ) { try { if ( "" . equals ( userId ) ) userId = null ; logDebug ( "setUserId(" + userId + ")" ) ; // Do nothing if not initialized if ( ! isInitialized ( ) ) { logDebug ( "setting user id for next initialization" ) ; sBeforeInitializationUserIdSet = true ; sBeforeInitializationUserId = userId ; return ; } sBeforeInitializationUserIdSet = false ; sBeforeInitializationUserId = null ; String oldUserId = WonderPushConfiguration . getUserId ( ) ; if ( userId == null && oldUserId == null || userId != null && userId . equals ( oldUserId ) ) { // User id is the same as before, nothing needs to be done } else { // The user id changed, we must reset the access token initForNewUser ( userId ) ; } } catch ( Exception e ) { Log . e ( TAG , "Unexpected error while setting userId to \"" + userId + "\"" , e ) ; } }
Sets the user id used to identify a single identity across multiple devices and to correctly identify multiple users on a single device .