Mobincube Apps provide the developers with a lot of information related to the App and user status. This information is stored in the global variables of the App. Using this variables, you will be able to analyze your users activity and provide a better service.
The global variables available in the App are the next ones:
{instance} -> unique ID string. Its length depends on the system. It doesn’t change until the App is deleted.
{location} -> Contains the location of the device in the format: “longitude, latitude”.
It refreshes every 10 seconds.
{appId} -> ID of the App. Each App created on Mobincube has its own ID. (No longer available)
{deviceInfo} -> Brand and model of the device.
{deviceType} -> Tablet/smartphone.
{osVersion} -> System OS version.
{language} -> Device language (es,en,pt,fr…)
{screenSize} -> Screen size (width x height)
{sectionName} -> Current section name.
{country} -> Current country where the device is located. (No longer available)
{ISOCountry} -> Country code where the device is located (No longer available)
{dataConnection} -> Internet connection type: WiFi,WWan, 3G, 4G…
{postalCode} -> Postal code where the device is located.
{address} -> Address of the device's current location.
{locality} -> City of the device's current location.
{subLocality} -> Area of the device's current location.
{adminArea} -> County of the device's current location.
{subAdminArea} -> Province of the device's current location.
{density} -> Screen density factor: 3.0=iPhone plus, 2.0= retina, 1.0 = no retina
{IP} -> Device IP. (No longer available)
{token} -> Unique ID for push notifications
{fcmToken} -> Token generated on iOS for Firebase notifications.
{carrierName} -> ISP. (No longer available)
{bundleID} -> Package name on android or bundle ID in iOS.
{appBuildTime} -> Date when the App was generated.
{appVersion} -> App version.
How to obtain the system variables?
We need to ask the App for the variables we want it to send us. To do that, we need to make a call using the Mobincube protocol using the following format:
mobincube://javascript/[Callback_function_name]('{variable1}','{variable2}',…)
The callback function is a function we will have to create in our own code:
function getVariables(instance,country){
// Use the variables as we want
}
The Mobincube protocol call to use that function will be:
window.location.href= “mobincube://javascript/getVariables('{instance}','{country}')”;
After making a call using the Mobincube protocol, the App will get the information of the variables we asked for and it will call the callback function, passing the asked variables as parameters of the function.
getVariables(‘12737126378126’,USA);
We can run any logic we need inside the function.
Note: Variables related to user position (city, country…) may slow the App since they need to be calculated out of the app.