# SipProfile.Builder

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/net/sip/SipProfile.Builder "View this page in Java")  

```
open class Builder
```

|---|--------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                           ||
| ↳ | [android.net.sip.SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#) |

*** ** * ** ***

| **This class was deprecated in API level 31.**
|
| Deprecated in Java.

Helper class for creating a[SipProfile](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile).

## Summary

|                                                                                                                                                                     Public constructors                                                                                                                                                                      ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#Builder(android.net.sip.SipProfile))`(`profile:` `[SipProfile](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile)!`)` Creates a builder based on the given profile.                                                                   |
| [Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#Builder(kotlin.String))`(`uriString:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Constructor.                                                                                                                      |
| [Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#Builder(kotlin.String,%20kotlin.String))`(`username:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `serverDomain:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Constructor. |

|                                                                                                                                                                                             Public methods                                                                                                                                                                                              ||
|---------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[SipProfile](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile)!                  | [build](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#build())`()` Builds and returns the SIP profile object.                                                                                                                                        |
| open[SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | [setAuthUserName](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#setAuthUserName(kotlin.String))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Sets the username used for authentication.            |
| open[SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | [setAutoRegistration](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#setAutoRegistration(kotlin.Boolean))`(`flag:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets the auto.                              |
| open[SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | [setDisplayName](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#setDisplayName(kotlin.String))`(`displayName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Sets the display name of the user.               |
| open[SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | [setOutboundProxy](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#setOutboundProxy(kotlin.String))`(`outboundProxy:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Sets the outbound proxy of the SIP server. |
| open[SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | [setPassword](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#setPassword(kotlin.String))`(`password:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Sets the password of the SIP account                      |
| open[SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | [setPort](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#setPort(kotlin.Int))`(`port:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the port number of the server.                                             |
| open[SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | [setProfileName](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#setProfileName(kotlin.String))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Sets the name of the profile.                           |
| open[SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | [setProtocol](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#setProtocol(kotlin.String))`(`protocol:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Sets the protocol used to connect to the SIP server.      |
| open[SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | [setSendKeepAlive](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#setSendKeepAlive(kotlin.Boolean))`(`flag:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets the send keep-alive flag.                    |

## Public constructors

### Builder

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder(profile: SipProfile!)
```

Creates a builder based on the given profile.  

### Builder

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder(uriString: String!)
```

Constructor.

|                                                        Parameters                                                        ||
|-------------|-------------------------------------------------------------------------------------------------------------|
| `uriString` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the URI string as "sip:@" |

|                          Exceptions                          ||
|----------------------------|----------------------------------|
| `java.text.ParseException` | if the string is not a valid URI |

### Builder

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder(
    username: String!, 
    serverDomain: String!)
```

Constructor.

|                                                                                                                                                                 Parameters                                                                                                                                                                  ||
|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `username`     | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:username of the SIP account                                                                                                                                                                                                               |
| `serverDomain` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the SIP server domain; if the network address is different from the domain, use[setOutboundProxy](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#setOutboundProxy(kotlin.String))to set server address |

|                         Exceptions                          ||
|----------------------------|---------------------------------|
| `java.text.ParseException` | if the parameters are not valid |

## Public methods

### build

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun build(): SipProfile!
```

**Deprecated:** *Deprecated in Java.*

Builds and returns the SIP profile object.

|                                                        Return                                                        ||
|------------------------------------------------------------------------------------------|----------------------------|
| [SipProfile](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile)! | the profile object created |

### setAuthUserName

Added in[API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setAuthUserName(name: String!): SipProfile.Builder!
```

**Deprecated:** *Deprecated in Java.*

Sets the username used for authentication.

|                                                            Parameters                                                            ||
|--------|--------------------------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:authentication username of the profile |

|                                                             Return                                                             ||
|-----------------------------------------------------------------------------------------------------------|---------------------|
| [SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | this builder object |

### setAutoRegistration

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setAutoRegistration(flag: Boolean): SipProfile.Builder!
```

**Deprecated:** *Deprecated in Java.*

Sets the auto. registration flag.

|                                                                            Parameters                                                                            ||
|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `flag` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):true if the profile will be registered automatically, false otherwise |

|                                                             Return                                                             ||
|-----------------------------------------------------------------------------------------------------------|---------------------|
| [SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | this builder object |

### setDisplayName

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setDisplayName(displayName: String!): SipProfile.Builder!
```

**Deprecated:** *Deprecated in Java.*

Sets the display name of the user.

|                                                        Parameters                                                         ||
|---------------|------------------------------------------------------------------------------------------------------------|
| `displayName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:display name of the user |

|                                                             Return                                                             ||
|-----------------------------------------------------------------------------------------------------------|---------------------|
| [SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | this builder object |

### setOutboundProxy

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setOutboundProxy(outboundProxy: String!): SipProfile.Builder!
```

**Deprecated:** *Deprecated in Java.*

Sets the outbound proxy of the SIP server.

|                                                                  Parameters                                                                  ||
|-----------------|-----------------------------------------------------------------------------------------------------------------------------|
| `outboundProxy` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the network address of the outbound proxy |

|                                                             Return                                                             ||
|-----------------------------------------------------------------------------------------------------------|---------------------|
| [SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | this builder object |

### setPassword

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setPassword(password: String!): SipProfile.Builder!
```

**Deprecated:** *Deprecated in Java.*

Sets the password of the SIP account

|                                                        Parameters                                                         ||
|------------|---------------------------------------------------------------------------------------------------------------|
| `password` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:password of the SIP account |

|                                                             Return                                                             ||
|-----------------------------------------------------------------------------------------------------------|---------------------|
| [SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | this builder object |

### setPort

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setPort(port: Int): SipProfile.Builder!
```

**Deprecated:** *Deprecated in Java.*

Sets the port number of the server. By default, it is 5060.

|                                                  Parameters                                                  ||
|--------|------------------------------------------------------------------------------------------------------|
| `port` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):port number of the server |

|                                                             Return                                                             ||
|-----------------------------------------------------------------------------------------------------------|---------------------|
| [SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | this builder object |

|                                Exceptions                                ||
|--------------------------------------|------------------------------------|
| `java.lang.IllegalArgumentException` | if the port number is out of range |

### setProfileName

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setProfileName(name: String!): SipProfile.Builder!
```

**Deprecated:** *Deprecated in Java.*

Sets the name of the profile. This name is given by user.

|                                                  Parameters                                                   ||
|--------|-------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:name of the profile |

|                                                             Return                                                             ||
|-----------------------------------------------------------------------------------------------------------|---------------------|
| [SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | this builder object |

### setProtocol

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setProtocol(protocol: String!): SipProfile.Builder!
```

**Deprecated:** *Deprecated in Java.*

Sets the protocol used to connect to the SIP server. Currently, only "UDP" and "TCP" are supported.

|                                                    Parameters                                                     ||
|------------|-------------------------------------------------------------------------------------------------------|
| `protocol` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the protocol string |

|                                                             Return                                                             ||
|-----------------------------------------------------------------------------------------------------------|---------------------|
| [SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | this builder object |

|                               Exceptions                                ||
|--------------------------------------|-----------------------------------|
| `java.lang.IllegalArgumentException` | if the protocol is not recognized |

### setSendKeepAlive

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setSendKeepAlive(flag: Boolean): SipProfile.Builder!
```

**Deprecated:** *Deprecated in Java.*

Sets the send keep-alive flag.

|                                                                         Parameters                                                                         ||
|--------|----------------------------------------------------------------------------------------------------------------------------------------------------|
| `flag` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):true if sending keep-alive message is required, false otherwise |

|                                                             Return                                                             ||
|-----------------------------------------------------------------------------------------------------------|---------------------|
| [SipProfile.Builder](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile.Builder#)! | this builder object |