Search code examples
javascriptreact-nativescopesentry

Show/Get runtime, os, device contexts from Sentry Javascript


I am trying to get the runtime, os and/or device context/information that Sentry measures when send a event, for example: enter image description here

I want to recycle that information in a react-native app to send to my API and make analytics; so that information must be in a normal JavaScript object and need to be acquire in any moment, not only when the app crash and Sentry send events ;).

Can you help me with this, I only find forms to setContext and complete that information, but not how get it in runtime.

Thank you every one for your support.


Solution

  • Those informations are collected by Sentry via their Native integrations (https://github.com/getsentry/sentry-react-native).

    I propose You to get those informations on Your own via https://github.com/react-native-community/react-native-device-info

    The base OS build the product is based on:

    DeviceInfo.getBaseOs().then(baseOs => {
      // "Windows", "Android" etc
    });
    

    Get the device name:

    DeviceInfo.getDeviceName().then(deviceName => {
      // iOS: "Becca's iPhone 6"
      // Android: ?
      // Windows: ?
    });