应用程序运行时未调用 onBackPressed 方法,因此我无法正确退出应用程序我添加了一条日志消息,但我没有看到它在任何地方调用可能是什么问题
主要活动
@Override
public void onBackPressed() {
Log.v(TAG, "=== onBackPressed start ===");
if (GoogleSocial.onBackPressed())
return;
else
super.onBackPressed();
Log.v(TAG, "=== onBackPressed end ===");
}
谷歌社交
public class GoogleSocial {
private static final String TAG = "Chartboost";
static Chartboost s_cb = null;
static Activity s_act = null;
private static AppLovinSdk sdk;
public static void init(final Activity act, final String appId, final String appSign, String mopubId, boolean isPaid) {
s_act = act;
act.runOnUiThread(new Runnable() {
public void run() {
Chartboost.startWithAppId(act, appId, appSign);
Chartboost.setLoggingLevel(Level.ALL);
AppLovinSdk.initializeSdk(s_act);
}
});
}
public static void showBanner() {
}
public static void hideBanner() {
}
public static void showInterstitialAdForSdkKey( final String sdkKey){
Log.v(TAG, "showFullScreen");
sdk = AppLovinSdk.getInstance("bIEl5bkQbMybxFHahXaFxgSMsK2MesEF8qDLfXN1BEFQMiPam5EP9qe8eAhADrxCe8X", new AppLovinSdkSettings(), s_act);
AppLovinInterstitialAd.show(s_act);
s_act.runOnUiThread( new Runnable() {
public void run() {
AppLovinInterstitialAd.show(sdk, s_act);
}
});
}
public static void showAd() {
Log.v(TAG, "Aggregator.showAd() is called...");
s_act.runOnUiThread(new Runnable() {
public void run() {
// s_cb.showMoreApps();
showInterstitialAdForSdkKey("bIEl5bkQbMybxFHahXaFxgSMsK2MesEF8qDLfXN1BEFQMiPam5EP9qe8eAhADrxCe8X");
Chartboost.showInterstitial(CBLocation.LOCATION_DEFAULT);
// Chartboost.showRewardedVideo(CBLocation.LOCATION_DEFAULT);
// Chartboost.showMoreApps(CBLocation.LOCATION_DEFAULT);
}
});
}
public static void showMoregame() {
Log.v(TAG, "showMoreApps() is called...");
s_act.runOnUiThread(new Runnable() {
public void run() {
// s_cb.showMoreApps();
// Chartboost.showInterstitial(CBLocation.LOCATION_DEFAULT);
// Chartboost.showRewardedVideo(CBLocation.LOCATION_DEFAULT);
Chartboost.showMoreApps(CBLocation.LOCATION_DEFAULT);
}
});
}
public static void onStart() {
Chartboost.onStart(s_act);
}
public static void onPause() {
Chartboost.onPause(s_act);
}
public static void onStop() {
Chartboost.onStop(s_act);
}
public static void onResume() {
Chartboost.onResume(s_act);
}
public static void onDestroy() {
Chartboost.onDestroy(s_act);
}
public static boolean onBackPressed() {
if (Chartboost.onBackPressed())
return true;
return true;
}
}