Package com.mparticle.identity
Class IdentityApi
- java.lang.Object
-
- com.mparticle.identity.IdentityApi
-
public class IdentityApi extends java.lang.ObjectHelper class that is used to access Identity endpoints to manage User's Attributes and Identities.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceIdentityApi.MpIdChangeListener
-
Field Summary
Fields Modifier and Type Field Description static intBAD_REQUESTstatic intSERVER_ERRORstatic intTHROTTLE_ERRORstatic intUNKNOWN_ERROR
-
Constructor Summary
Constructors Modifier Constructor Description protectedIdentityApi()IdentityApi(android.content.Context context, com.mparticle.internal.AppStateManager appStateManager, com.mparticle.internal.MessageManager messageManager, com.mparticle.internal.ConfigManager configManager, com.mparticle.internal.KitManager kitManager, MParticle.OperatingSystem operatingSystem)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddIdentityStateListener(IdentityStateListener listener)Adds a global listener which will be invoked when the MPID or "logged in" status changes for the current user.booleanaliasUsers(AliasRequest aliasRequest)Initiate an Alias request.MParticleUsergetCurrentUser()return the MParticleUser with the current MPID, even if an Identity request, which might cause the MPID to change, is currently in progress.java.lang.StringgetDeviceApplicationStamp()MParticleUsergetUser(java.lang.Long mpid)Return the MParticleUser with the specified MPID, if it exists.java.util.List<MParticleUser>getUsers()returns a list ofMParticleUsers that have been seen by this device.MParticleTask<IdentityApiResult>identify(IdentityApiRequest identifyRequest)Calls the Identity Identify endpoint.IdentityApi.InternalInternal()MParticleTask<IdentityApiResult>login()Calls the Identity Login endpoint with an empty IdentityApiRequest.MParticleTask<IdentityApiResult>login(IdentityApiRequest loginRequest)Calls the Identity Login endpoint.MParticleTask<IdentityApiResult>logout()Calls the Identity Logout endpoint with an empty IdentityApiRequest.MParticleTask<IdentityApiResult>logout(IdentityApiRequest logoutRequest)BaseIdentityTaskmodify(IdentityApiRequest updateRequest)Calls the Identity Modify endpoint.voidremoveIdentityStateListener(IdentityStateListener listener)Removes an instance of a global listener by reference.
-
-
-
Constructor Detail
-
IdentityApi
protected IdentityApi()
-
IdentityApi
public IdentityApi(android.content.Context context, com.mparticle.internal.AppStateManager appStateManager, com.mparticle.internal.MessageManager messageManager, com.mparticle.internal.ConfigManager configManager, com.mparticle.internal.KitManager kitManager, MParticle.OperatingSystem operatingSystem)
-
-
Method Detail
-
getCurrentUser
@Nullable public MParticleUser getCurrentUser()
return the MParticleUser with the current MPID, even if an Identity request, which might cause the MPID to change, is currently in progress.- See Also:
IdentityStateListener
-
getUser
@Nullable public MParticleUser getUser(@NonNull java.lang.Long mpid)
Return the MParticleUser with the specified MPID, if it exists. If an MParticleUser with the specified MPID does not exist, or the specifid MPID is 0, this will return null.- Parameters:
mpid- the desired MParticleUser's MPID
-
getUsers
@NonNull public java.util.List<MParticleUser> getUsers()
returns a list ofMParticleUsers that have been seen by this device. The collection is ordered byMParticleUser.getLastSeenTime(), from most to least recent- Returns:
- a collection of
MParticleUserordered by descendingMParticleUser.getLastSeenTime()
-
getDeviceApplicationStamp
@NonNull public java.lang.String getDeviceApplicationStamp()
-
addIdentityStateListener
public void addIdentityStateListener(@NonNull IdentityStateListener listener)Adds a global listener which will be invoked when the MPID or "logged in" status changes for the current user.- Parameters:
listener- callback for Identity State changes- See Also:
IdentityStateListener
-
removeIdentityStateListener
public void removeIdentityStateListener(@NonNull IdentityStateListener listener)Removes an instance of a global listener by reference.- Parameters:
listener- callback for Identity State changes- See Also:
IdentityStateListener
-
logout
@NonNull public MParticleTask<IdentityApiResult> logout()
Calls the Identity Logout endpoint with an empty IdentityApiRequest.- Returns:
- an MParticleTask
to handle the Asynchronous results - See Also:
and,IdentityApiResult
-
logout
@NonNull public MParticleTask<IdentityApiResult> logout(@Nullable IdentityApiRequest logoutRequest)
- Returns:
- an MParticleTask
to handle the Asynchronous results - See Also:
calls the Identity Logout endpoint,and,IdentityApiResult
-
login
@NonNull public MParticleTask<IdentityApiResult> login()
Calls the Identity Login endpoint with an empty IdentityApiRequest.- Returns:
- an MParticleTask
to handle the Asynchronous results - See Also:
and,IdentityApiResult
-
login
@NonNull public MParticleTask<IdentityApiResult> login(@Nullable IdentityApiRequest loginRequest)
Calls the Identity Login endpoint.- Returns:
- an MParticleTask
to handle the Asynchronous results - See Also:
IdentityApiRequest,and,IdentityApiResult
-
identify
@NonNull public MParticleTask<IdentityApiResult> identify(@Nullable IdentityApiRequest identifyRequest)
Calls the Identity Identify endpoint.- Returns:
- an MParticleTask
to handle the Asynchronous results - See Also:
IdentityApiRequest,and,IdentityApiResult
-
modify
@NonNull public BaseIdentityTask modify(@NonNull IdentityApiRequest updateRequest)
Calls the Identity Modify endpoint. This should be used in place of the pre-version-5 MParticle.setUserAttribute() and MParticle.setUserIdentity() methods.- Returns:
- an MParticleTask
to handle the Asynchronous results - See Also:
IdentityApiRequest,BaseIdentityTask
-
aliasUsers
public boolean aliasUsers(@NonNull AliasRequest aliasRequest)Initiate an Alias request. Retries are handled internally, so one anAliasRequestis submitted, it will be retried unless there are unrecoverable errors. To listen for updates submit an implementation ofSdkListenertoMParticle.addListener(Context, SdkListener)- Parameters:
aliasRequest-- Returns:
-
Internal
@NonNull public IdentityApi.Internal Internal()
-
-