Skip to main content
Documentation - Discord Docs

Search documentation

Type to search this documentation.

On this pageOverview

Mobile

By default, your Activity will be launchable on web/desktop. To enable or disable support for Web/iOS/Android, do the following:

  • Visit the developer portal
  • Select your application
  • Select Activities -> Settings in the left-side of the developer portal
  • From check the appropriate checkboxes in the developer portal, and save your changes

supported-platforms


As an example, you can define your safe area insets as below in CSS:

CSS
:root {
  --sait: var(--discord-safe-area-inset-top, env(safe-area-inset-top));
  --saib: var(--discord-safe-area-inset-bottom, env(safe-area-inset-bottom));
  --sail: var(--discord-safe-area-inset-left, env(safe-area-inset-left));
  --sair: var(--discord-safe-area-inset-right, env(safe-area-inset-right));
}

This prefers the --discord-safe-area-inset-* variable and will fallback to the env values for iOS + any local dev testing that is done outside of Discord.

You can then reference these values:

CSS
body {
  padding-left: var(--sail);
  padding-right: var(--sair);
  padding-top: var(--sait);
  padding-bottom: var(--saib);
}

You may need to respond to thermal state changes using recommendations from thermal states surfaced by mobile devices to improve the user experience.

Discord's Embedded App SDK provides an abstraction over Apple's thermal state APIs and Android's thermal state APIs.

Here's how Discord's abstraction maps to Apple's thermal states and Android's thermal states.

JavaScript
enum ThermalState {
  NOMINAL = 0, // maps to "nominal" on iOS and "none" on Android
  FAIR = 1, // maps to "fair" on iOS and "light" / "moderate" on Android
  SERIOUS = 2, // maps to "serious" on iOS and "severe" on Android
  CRITICAL = 3, // maps to "critical" on iOS and "critical" / "emergency" / "shutdown" on Android
}

The Embedded App SDK allows developers to subscribe to these thermal state changes.

JavaScript
const handleThermalStateUpdate = (update: {thermal_state: number}) => {
  switch (thermalState) {
      case Common.ThermalStateTypeObject.NOMINAL:
        ...
      case Common.ThermalStateTypeObject.FAIR:
        ...
      case Common.ThermalStateTypeObject.SERIOUS:
        ...
      case Common.ThermalStateTypeObject.CRITICAL:
        ...
      default:
        ...
    }
}

discordSdk.subscribe('THERMAL_STATE_UPDATE', handleThermalStateUpdate);

Discord will publish the current thermal state upon event subscription, and it will also publish any thermal state changes that happen afterward.

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu