Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add com.snowplowanalytics.snowplow/mobile_context/jsonschema/1-0-3 (close #1252) #1253

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions schemas/com.snowplowanalytics.snowplow/mobile_context/jsonschema/1-0-3
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#",
"description": "Schema for mobile contexts",
"self": {
"vendor": "com.snowplowanalytics.snowplow",
"name": "mobile_context",
"format": "jsonschema",
"version": "1-0-3"
},
"type": "object",
"properties": {
"osType": {
"type": "string",
"description": "Operating system type (e.g., ios, tvos, watchos, osx, android)"
},
"osVersion": {
"type": "string",
"description": "The current version of the operating system"
},
"deviceManufacturer": {
"type": "string",
"description": "The manufacturer of the product/hardware"
},
"deviceModel": {
"type": "string",
"description": "The end-user-visible name for the end product"
},
"carrier": {
"type": ["string", "null"],
"description": "The carrier of the SIM inserted in the device"
},
"networkType": {
"type": ["string", "null"],
"enum": ["mobile", "wifi", "offline", null],
"description": "Type of network the device is connected to"
},
"networkTechnology": {
"type": ["string", "null"],
"description": "Radio access technology that the device is using"
},
"openIdfa": {
"type": ["string", "null"],
"description": "Deprecated tracking identifier for iOS"
},
"appleIdfa": {
"type": ["string", "null"],
"description": "Advertising identifier on iOS"
},
"appleIdfv": {
"type": ["string", "null"],
"description": "UUID identifier for vendors on iOS"
},
"androidIdfa": {
"type": ["string", "null"],
"description": "Advertising identifier on Android"
},
"physicalMemory": {
"type": ["integer", "null"],
"minimum": 0,
"maximum": 9223372036854775807,
"description": "Total physical system memory in bytes"
},
"systemAvailableMemory": {
"type": ["integer", "null"],
"minimum": 0,
"maximum": 9223372036854775807,
"description": "Available memory on the system in bytes (Android only)"
},
"appAvailableMemory": {
"type": ["integer", "null"],
"minimum": 0,
"maximum": 9223372036854775807,
"description": "Amount of memory in bytes available to the current app (iOS only)"
},
"batteryLevel": {
"type": ["integer", "null"],
"minimum": 0,
"maximum": 100,
"description": "Remaining battery level as an integer percentage of total battery capacity"
},
"batteryState": {
"type": ["string", "null"],
"enum": ["unplugged", "charging", "full", null],
"maxLength": 255,
"description": "Battery state for the device"
},
"lowPowerMode": {
"type": ["boolean", "null"],
"description": "A Boolean indicating whether Low Power Mode is enabled (iOS only)"
},
"availableStorage": {
"type": ["integer", "null"],
"minimum": 0,
"maximum": 9223372036854775807,
"description": "Bytes of storage remaining"
},
"totalStorage": {
"type": ["integer", "null"],
"minimum": 0,
"maximum": 9223372036854775807,
"description": "Total size of storage in bytes"
},
"isPortrait": {
"type": ["boolean", "null"],
"description": "A Boolean indicating whether the device orientation is portrait (either upright or upside down)"
},
Comment on lines +103 to +106
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you only get a boolean here, no way to understand the actual device orientation? (i.e. upsidedown)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible to understand the orientation in more detail but the problem is that iOS and Android report it in a different way and I wasn't able to find a mapping between the states.

Here is a table with the values, I was only able to confidently map the portrait positions but not sure whether the natural landscape on Android is left or right on iOS and there are also extra positions on each platform not on the other (such as face up or down).

iOS Android Description
portrait portrait_primary Home button at the bottom
portraitUpsideDown portrait_secondary Home button at the top
landscapeLeft ? Home button on the right side
landscapeRight ? Home button on the left side
faceUp ? parallel to the ground with the screen facing upwards
faceDown ? parallel to the ground with the screen facing downwards
? landscape can represent landscape-primary, landscape-secondary or both
? landscape_primary natural orientation for landscape
? landscape_secondary rotated 180° from its natural orientation
? natural either portrait-primary or landscape-primary depending on the device's usual orientation
? portrait portrait-primary, portrait-secondary or both

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with the boolean since this is the current state ^^

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh Android.

I think a boolean is probably a good idea 😂

"resolution": {
"type": ["string", "null"],
"maxLength": 20,
"description": "Screen resolution in pixels. Arrives in the form of WIDTHxHEIGHT (e.g., 1200x900). Doesn't change when device orientation changes"
},
"scale": {
"type": ["number", "null"],
"minimum": 0,
"maximum": 1000,
"description": "Scale factor used to convert logical coordinates to device coordinates of the screen (uses UIScreen.scale on iOS and DisplayMetrics.density on Android)"
},
"language": {
"type": ["string", "null"],
"maxLength": 8,
"description": "System language currently used on the device (ISO 639)"
},
"appSetId": {
"type": ["string", "null"],
"format": "uuid",
"description": "Android vendor ID scoped to the set of apps published under the same Google Play developer account (see https://developer.android.com/training/articles/app-set-id)"
},
"appSetIdScope": {
"type": ["string", "null"],
"enum": ["app", "developer", null],
"description": "Scope of the `appSetId`. Can be scoped to the app or to a developer account on an app store (all apps from the same developer on the same device will have the same ID)"
}
},
"required": ["osType", "osVersion", "deviceManufacturer", "deviceModel"],
"additionalProperties": false
}