APIs & services / urvi-app-service

Bind this device to the user.

Endpointtoday's app
Call
POST /gateway/urvi-app-service/api/v1/user-device-session
Service
urvi-app-service
Features
Device registration and remote actions
When
After login when no session exists
Auth
X-Sessionid header
In the App Service

Use case

Online call from DeviceRegistrationViewModel.registerNewDeviceSession when the check returned no binding. Binds this device to the user; the returned id is saved in SharedPreferences (device_registration_prefs/device_session_id) and the flow proceeds to Home. A non-success or empty body shows an error and the user stays on the registration screen.

Headers

HeaderValueNotes
X-SESSIONID<session token>Added by AuthInterceptor (data/net/AuthInterceptor.kt) when the call does not set it; on HTTP 401 or 400 the interceptor invalidates the token, fetches a new one and retries the request once.
Content-Typeapplication/jsonStatic @Headers on the Retrofit method.

Request

Example request body (synthetic data)
{
  "id": 0,
  "userId": 12345,
  "deviceId": "<android id>",
  "deviceType": "MOBILE",
  "deviceBrand": "Brand A",
  "deviceManufacture": "Manufacturer A",
  "deviceModel": "Model A",
  "deviceFingerprint": "<build fingerprint>",
  "macAddress": "02:00:00:00:00:00",
  "ipAddress": "10.0.0.2",
  "deviceOs": "Android",
  "osVersion": "14",
  "appVersion": "1.2.3",
  "loginDateTime": "2026-07-01T10:00:00.000Z",
  "deviceStatus": "DEVICE_STATUS.LIVE",
  "appCreatedAt": 1780000000000,
  "appLastModifiedAt": 1780000000000
}
FieldTypeRequiredNotes
idlongYesAlways 0.
userIdlongYesBridge user id.
deviceId / deviceType / deviceBrand / deviceManufacture / deviceModel / deviceFingerprintstringYesFrom DeviceInfoProvider.
macAddress / ipAddressstringYesFrom DeviceInfoProvider (may be placeholder values on modern Android).
deviceOs / osVersion / appVersionstringYesOS name, version, app versionName.
loginDateTimestringYesNow, yyyy-MM-dd'T'HH:mm:ss.SSS'Z'.
deviceStatusstringYesAlways DEVICE_STATUS.LIVE.
appCreatedAt / appLastModifiedAtlongYesNow in epoch ms.

Response

Example response body (synthetic data)
778
FieldTypeRequiredNotes
(body)longNew device session id, saved locally and passed to Proceed.

Errors

StatusWhenWhat the app does
401 / 400Session token expiredAuthInterceptor invalidates the token, gets a fresh session id and retries the request once.
any non-2xxOther failuresError state 'failed to register: <message>' or 'no id returned'; network exception -> 'network error registering'.

Source

  • app/src/main/java/org/platformcommons/urvi/view/deviceregistration/DeviceSessionApi.kt
  • app/src/main/java/org/platformcommons/urvi/view/deviceregistration/DeviceRegistrationViewModel.kt
  • app/src/main/java/org/platformcommons/urvi/view/deviceregistration/DeviceSessionModels.kt
  • app/src/main/java/org/platformcommons/urvi/view/deviceregistration/DeviceInfoProvider.kt