# Contacts for the Android SDK

Identify contacts, reset contacts, and get named user IDs.

A Contact is any user in your project. Contacts are identified as either an Anonymous Contact or a Named User. Airship can set targeting data on these identifiers, which are also used to map devices and channels to a specific user. For detailed information about contacts and named users, see [Named users](https://www.airship.com/docs/guides/audience/named-users/).

## Managing the Contact's identifier (Named User ID)

You can call `identify` multiple times with the same Named User ID. The SDK automatically deduplicates `identify`
calls made with the same Named User ID. If you change the ID from a previous value, the SDK automatically 
dissociates the Contact from the previous Named User ID.


#### Kotlin


```kotlin
Airship.contact.identify("some named user ID")
```



#### Java


```java
Airship.getContact().identify("some named user ID");
```




If the user logs out of the device, you may want to reset the contact. Resetting clears
any anonymous data and dissociates the contact from the Named User ID, if set. Call this
method only when the user manually logs out of the app. Otherwise, you cannot
target the Channel by its Contact data. 


#### Kotlin


```kotlin
Airship.contact.reset()
```



#### Java


```java
Airship.getContact().reset();
```




You can retrieve the Named User ID only if you set it through the SDK.


#### Kotlin


```kotlin
Airship.contact.namedUserId
```



#### Java


```java
Airship.getContact().getNamedUserId();
```




### Email channel association
 
When an email address is registered through the SDK, it will be registered for both transactional and commercial emails by default. To change this behavior, you can override the options to request [[Double Opt-In](https://www.airship.com/docs/reference/glossary/#double_opt_in)](https://www.airship.com/docs/developer/api-integrations/email/getting-started/#double-opt-in) for commercial messages.


#### Kotlin


```kotlin
val properties = JsonMap.newBuilder().put("place", "paris").build()
val options = EmailRegistrationOptions.commercialOptions(commercialDate, transactionalDate, properties)
Airship.contact.registerEmail("your@example.com", options)
```



#### Java


```java
JsonMap properties = JsonMap.newBuilder().put("place", "paris").build();
EmailRegistrationOptions options = EmailRegistrationOptions.commercialOptions(commercialDate, transactionalDate, properties);
Airship.getContact().registerEmail("your@example.com", options);
```




### SMS channel association

When an [MSISDN](https://www.airship.com/docs/reference/glossary/#msisdn) is registered through the SDK, Airship sends a message to that number, prompting them to opt in. For more information, see the SMS platform documentation: [Non-Mobile Double Opt-In](https://www.airship.com/docs/developer/api-integrations/sms/opt-in-out-handling/#non-mobile-double-opt-in).


#### Kotlin


```kotlin
val options = SmsRegistrationOptions.options("senderId")
Airship.contact.registerSms("yourMsisdn", options)
```



#### Java


```java
SmsRegistrationOptions options = SmsRegistrationOptions.options("senderId");
Airship.getContact().registerSms("yourMsisdn", options);
```




### Open Channel association

Open Channels support notifications to any medium that can accept a JSON payload, through either the Airship API or web dashboard.
For more information about Open Channels, see the [Open Channels documentation](https://www.airship.com/docs/developer/api-integrations/open/getting-started/).


#### Kotlin


```kotlin
val options = OpenChannelRegistrationOptions.options("platformName")
Airship.contact.registerOpenChannel("address", options)
```



#### Java


```java
OpenChannelRegistrationOptions options = OpenChannelRegistrationOptions.options("platformName");
Airship.getContact().registerOpenChannel("address", options);
```



