UserContextSystem
ClassProvides information about the user such as display name, birthday, and current weather.
- Available on all platforms
Provides information about the user such as display name, birthday, and current weather. Accessible through global.userContextSystem.
All callbacks will execute as soon as the requested information is available. In some rare cases, the requested information may be completely unavailable, and the callback will never occur.
Note that formatted or localized strings may appear differently to users depending on their region.
Index
Methods
- getAllFriends
- getAllFriendsSafeInfo
- getBestFriends
- getCurrentUser
- getCurrentUserSafeInfo
- getFriendsWithAvailableMySelfie
- getFriendsWithAvailableMySelfieSafeInfo
- getMyAIUser
- getMyAIUserSafeInfo
- getPinnedBestFriends
- getTypeName
- getUsersInCurrentContext
- getUsersInCurrentContextSafeInfo
- isOfType
- isSame
- loadResourceAsSnapchatUser
- requestAltitudeFormatted
- requestAltitudeInMeters
- requestBirthdate
- requestBirthdateFormatted
- requestCity
- requestDisplayName
- requestTemperatureCelsius
- requestTemperatureFahrenheit
- requestTemperatureFormatted
- requestUsername
- requestWeatherCondition
- requestWeatherLocalized
Example
global.userContextSystem.requestDisplayName(function(displayName) {
print("Hello " + displayName);
});
global.userContextSystem.requestWeatherLocalized(function(weatherText) {
print("The weather outside is: " + weatherText);
});
global.userContextSystem.requestAltitudeFormatted(function(altitude) {
print("Your altitude is: " + altitude);
});
global.userContextSystem.requestCity(function(city) {
print("Your city is: " + city);
});
global.userContextSystem.requestBirthdateFormatted(function(birthdate) {
print("Your birthday is: " + birthdate);
});
Extends
Methods
getAllFriends()
getAllFriends(
callback):void
Exposes user dataCamera Kit
Retrieve the Snapchatter's friends list in order to access details like display name, birthdate, or Bitmoji
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
getAllFriendsSafeInfo()
getAllFriendsSafeInfo(
callback):void
Camera Kit
Retrieve the Snapchatter's friends list with Bitmoji info only.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
getBestFriends()
getBestFriends(
callback):void
Exposes user dataCamera Kit
Retrieve the Snapchatter's best friends in order to access details like display name, birthdate, or Bitmoji.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
getCurrentUser()
getCurrentUser(
callback):void
Exposes user data
Retrieve a user object representing the current user. Returns a SnapchatUser in the Snapchat runtime and a SpecsUser on Spectacles (SnapOS).
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
getCurrentUserSafeInfo()
getCurrentUserSafeInfo(
callback):void
Retrieve the current user with Bitmoji info only.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
getFriendsWithAvailableMySelfie()
getFriendsWithAvailableMySelfie(
callback):void
Exposes user dataCamera Kit
Retrieve the Snapchatter's friends who have a My Selfie identity that the current user is permitted to use for generation, in order to access details like display name, birthdate, or Bitmoji.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
getFriendsWithAvailableMySelfieSafeInfo()
getFriendsWithAvailableMySelfieSafeInfo(
callback):void
Camera Kit
Retrieve the Snapchatter's friends who have a My Selfie identity that the current user is permitted to use for generation, with Bitmoji info only.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
getMyAIUser()
getMyAIUser(
callback):void
Exposes user dataCamera Kit
Retrieve a user object for My AI, which you can use to access the My AI Bitmoji or other details.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
getMyAIUserSafeInfo()
getMyAIUserSafeInfo(
callback):void
Camera Kit
Retrieve MyAI user with Bitmoji info only.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
getPinnedBestFriends()
getPinnedBestFriends(
callback):void
Exposes user dataCamera Kit
Retrieve the Snapchatter's pinned best friends in order to access details like display name, birthdate, or Bitmoji.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
getTypeName()
staticgetTypeName():TypeName<UserContextSystem>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<UserContextSystem>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
getUsersInCurrentContext()
getUsersInCurrentContext(
callback):void
Exposes user dataCamera Kit
Gets the list of friends in the current context, such as 1:1 chats, 1:many chats, and group chats.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
getUsersInCurrentContextSafeInfo()
getUsersInCurrentContextSafeInfo(
callback):void
Camera Kit
Gets the list of friends in the current context with Bitmoji info only.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
loadResourceAsSnapchatUser()
loadResourceAsSnapchatUser(
resource,onSuccess,onFailure):void
Camera Kit
Get a user's information from a DynamicResource.
Parameters
| Parameter | Type |
|---|---|
resource | DynamicResource |
onSuccess | (snapchatUser) => void |
onFailure | (errorMessage) => void |
Returns
void
requestAltitudeFormatted()
requestAltitudeFormatted(
callback):void
Provides the user's current altitude as a localized string.
Parameters
| Parameter | Type |
|---|---|
callback | (formattedData) => void |
Returns
void
requestAltitudeInMeters()
requestAltitudeInMeters(
callback):void
Provides the user's current altitude in meters.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
requestBirthdate()
requestBirthdate(
callback):void
Exposes user data
Provides the user's birth date as a Date object.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
requestBirthdateFormatted()
requestBirthdateFormatted(
callback):void
Exposes user data
Provides the user's birth date as localized string.
Parameters
| Parameter | Type |
|---|---|
callback | (formattedData) => void |
Returns
void
requestCity()
requestCity(
callback):void
Exposes user data
Provides the name of the city the user is currently located in.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
requestDisplayName()
requestDisplayName(
callback):void
Provides the user's display name.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
requestTemperatureCelsius()
requestTemperatureCelsius(
callback):void
Provides the user's current temperature in celsius.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
requestTemperatureFahrenheit()
requestTemperatureFahrenheit(
callback):void
Provides the user's current temperature in fahrenheit.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
requestTemperatureFormatted()
requestTemperatureFormatted(
callback):void
Provides the user's current temperature as a localized string.
Parameters
| Parameter | Type |
|---|---|
callback | (formattedData) => void |
Returns
void
requestUsername()
requestUsername(
callback):void
Exposes user data
Provides the user's username.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
requestWeatherCondition()
requestWeatherCondition(
callback):void
Provides the user's current weather condition.
Parameters
| Parameter | Type |
|---|---|
callback | (data) => void |
Returns
void
requestWeatherLocalized()
requestWeatherLocalized(
callback):void
Provides the user's current weather condition as a localized string.
Parameters
| Parameter | Type |
|---|---|
callback | (formattedData) => void |
Returns
void