-
Notifications
You must be signed in to change notification settings - Fork 214
FAQ
The "notificationToken" : "xxx" was basically a standard device tracking parameter. This unique id can be used to roll out push notifications to the user, mainly used for ad-tracking. Completely optional. I just added it here because its a standard practice. Also, the place where I work (enterprise E-Commerce) we use many parameters for device tracking apart from deviceId and OsType. Notification token being one of them.
DeviceInfo class is just a way to honour the device context that most apps usually require. It can contain arbitrary fields based on the business. I only included the bare minimum.
Our project doesn't have a front-end yet. It is the frontend's responsibility to fetch device information and pass it to the backend. More on that here
Notification token is something I could have gotten rid of, but it adds a feel of "commercial" product, hence I kept it.
Initially, browser will make the following request on login.
`"deviceInfo": {`
`deviceId: null,`
`device_type: "DEVICE_TYPE_BROWSER"`
`}`
On successful login, login response should be modified to include the newly generated deviceId. If it is a mobile device, we simply return the deviceId provided.
After getting successful response, browser should store that in a session variable / cookie. It will use the given deviceId to make further calls such as logout. Upon logout, the token would be removed from the browser cookie.
Please note there are several fields that can be passed in a device context, all up to the developer to choose.
"deviceId" : "mandatory unique id",
"device_type": "ANDROID", //os type
"tablet": false, //tablet specific content can be shown
"notification_token": "some push notification token assigned by backend to be reused on subsequent logins",
"doNotTrack": false, //specify whether user wants to be tracked or not
"carrierId": 0, //[optional]specify the mobile carrier for SMS alerts e.g Vivo/Claro
"connectionType": 0, //[optional] specify whether the user is connected over Wifi/4g
Gist: Whatever frontend gives you, we can mark it in the DeviceInfo POJO and populate accordingly.