Skip to content

Commit

Permalink
Initialize Mintegral SDK in a background thread (to avoid ANRs).
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 691497491
  • Loading branch information
Mobile Ads Developer Relations authored and copybara-github committed Oct 30, 2024
1 parent 3592402 commit 4cca6af
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
3 changes: 3 additions & 0 deletions ThirdPartyAdapters/mintegral/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Mintegral Android Mediation Adapter Changelog

#### Next version
- Initialize Mintegral SDK in a background thread (to fix ANRs).

#### Version 16.8.61.0
- Verified compatibility with Mintegral SDK 16.8.61.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,29 @@ public void initialize(@NonNull Context context,
} catch (Throwable e) {
e.printStackTrace();
}
mBridgeSDK.init(configurationMap, context, new SDKInitStatusListener() {
@Override
public void onInitSuccess() {
initializationCompleteCallback.onInitializationSucceeded();
}

@Override
public void onInitFail(String errorMessage) {
AdError initError = createSdkError(MintegralConstants.ERROR_CODE_SDK_INIT_FAILED,
errorMessage);
initializationCompleteCallback.onInitializationFailed(initError.getMessage());
Log.w(TAG, initError.toString());
}
});
// Initialize the Mintegral SDK in a separate thread to avoid blocking the main thread.
new Thread(
() ->
mBridgeSDK.init(
configurationMap,
context,
new SDKInitStatusListener() {
@Override
public void onInitSuccess() {
initializationCompleteCallback.onInitializationSucceeded();
}

@Override
public void onInitFail(String errorMessage) {
AdError initError =
createSdkError(
MintegralConstants.ERROR_CODE_SDK_INIT_FAILED, errorMessage);
initializationCompleteCallback.onInitializationFailed(
initError.getMessage());
Log.w(TAG, initError.toString());
}
}))
.start();
}

@Override
Expand Down

0 comments on commit 4cca6af

Please sign in to comment.