Device Info

Call each page load

If your website defines a function called gonative_device_info() it will get called after every page load as shown below with an object that contains information about your native app and the user's device.

Trigger manually

You may also run gonative_device_info() manually at any time by calling

Return via a promise

Call gonative.deviceInfo.then() or use await gonative.deviceInfo() to return a promise that will resolve with the data.


You may POST the device data to your server via AJAX, or anything else that's required using JavaScript.


// You define this function on your page, but do not actually call it
// If present on a page it will be called by the app when the page is loaded
function gonative_device_info(deviceInfo) {

// You may also call the gonative_device_info function manually, e.g. on a single page web app;

// Or return the OneSignal Info via a promise (in async function)
var deviceInfo = await gonative.deviceInfo();

gonative.deviceInfo().then(function (deviceInfo) {

// deviceInfo will look like
    platform: 'ios',
    appId: 'io.gonative.example',
    appVersion:  '1.0.0',
    appBuild: '1.0.0' // will be appVersionCode (number) on Android
    distribution: 'release',
    hardware: 'armv8',
    installationId: 'xxxx-xxxx-xxxx-xxxx',
    apnsToken: '<xxxxxxxx xxxxxxxx xxxxxxxx ... >', // only on iOS
    language: 'en',
    model: 'iPhone',
    os: 'iOS',
    osVersion: '10.3',
    timeZone: 'America/New_York',
    isFirstLaunch: false // first time the app is launched


The gonative_device_info() function is called by the native app when the page is loaded within the app. This function must be available at the time of page load and cannot be loaded asynchronously or in a deferred manner.