您可以在應用程式啟動時,載入另一個 ADBMobile JSON 設定檔案。
Config.overrideConfigStream(configInput)
方法可讓您在應用程式啟動時,將路徑指定至不同的 ADBMobile.json
設定檔案。必須在任何其他 Experience Cloud SDK 呼叫前呼叫此方法 (在 Config.collectLifecycleData()
前),通常是在您首次載入活動的 onCreate
方法中。
使用不同的路徑呼叫此方法,會造成一次性的設定檔案覆寫,直到關閉應用程式為止。
try {
InputStream configInput = getAssets().open("ExampleJSONFile.json");
Config.overrideConfigStream(configInput);
} catch (IOException ex) {
// do something with the exception if needed
}