|
Discord Social SDK
|
The Discord Social SDK provides experimental support for iOS and Android mobile applications as a preview. To set it up in your project, there's a few things you need to do, depending on the engine or language you're using.
Please follow the PC development guide for Unity for general setup instructions. There are a few mobile-specific options you'll need to configure as well:
discordpp::Client::Authorize() support, you'll need to configure a callback URL scheme in your project settings. Open the project settings via Edit -> Project Settings... and navigate to the Player section. In the iOS tab, under Other Settings, locate the Supported URL Schemes option and add discord-<YOURAPPID> to the list. For example, if the application ID in the Discord developer portal is 123456, you'll add discord-123456 to the list.Info.plist for your project to enable the appropriate background modes. A build postprocessor is supplied in the Unity sample project that you may copy into your own project, located at Assets/Scripts/Editor/VoicePostBuildProcessor.cs.Info.plist to include the discord scheme. Below is the entry required to be added to your Info.plist.discordpp::Client::Authorize() requires an activity with a custom URL scheme to be added to your application manifest. An example build processor is provided in the sample project at Assets/Scripts/Editor/AndroidPostBuildProcessor.cs. The documentation for the Authorize method provides further details if you'd like to configure this yourself instead of using the sample code.androidx.browser as a Gradle dependency. If you use Google External Dependency Manager in your project, a suitable dependencies XML file is provided as part of the plugin, otherwise you will need to set this up manually.The Android SDK uses the following permissions:
android.permission.INTERNETandroid.permission.RECORD_AUDIOandroid.permission.FOREGROUND_SERVICEandroid.permission.FOREGROUND_SERVICE_MICROPHONEandroid.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACKandroid.permission.MODIFY_AUDIO_SETTINGSandroid.permission.BLUETOOTH (SDK <= 30)android.permission.BLUETOOTH_CONNECT (SDK >= 31)If your application does not use voice, you may remove all permissions except INTERNET using the tools:node="remove" attribute in your AndroidManifest.xml.
The Social SDK may be used as a C++ library in a standard iOS or Android project. To create a project which includes the SDK, follow the steps below for your platform of choice.
discord_partner_sdk.xcframework to your project and set your project settings as follows:discord_partner_sdk.xcframework to Embed & Signdiscordpp::Client::Authorize() support you must register the appropriate URL scheme in your Info.plist. It should be called discord-YOURAPPID, e.g. if your app ID in the Discord developer portal is 123456, you should register a URL scheme called discord-123456#include <discord_partner_sdk/discordpp.h>. Note that in exactly one file in your codebase, you should define #define DISCORDPP_IMPLEMENTATION before including this header to expand necessary implementation code into your project.discordpp::RunCallbacks().discord_partner_sdk.aar as a dependency in your Gradle project. For example, add it to a directory called app/libs and then in your app/build.gradle, add implementation files("libs/discord_partner_sdk.aar") to your dependencies section.find_package(discord_partner_sdk REQUIRED CONFIG) to your CMakeLists.txttarget_link_libraries(your_target discord_partner_sdk::discord_partner_sdk) to link Discord Social SDK#include "discordpp.h". Note that in exactly one file in your codebase, you should define #define DISCORDPP_IMPLEMENTATION before including this header to expand necessary implementation code into your project.onCreate method for your main activity, call com.discord.socialsdk.DiscordSocialSdkInit.setEngineActivity(this).discordpp::RunCallbacks().To support Authorize():
androidx.browser dependency to your project (version 1.8 or later)discordpp::Client::Authorize() for details.