最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Issues with Android Splash API - Stack Overflow

programmeradmin4浏览0评论

I'm experiencing problems with the Android Splash API. The scenario is as follows: When I first launch my application, the Splash screen displays correctly (everything works fine). The issue occurs when I close the app - for example, when I'm on the Login screen or any other screen - using System.exit(1) or finishAffinity(). When I try to reopen the app from the recent apps screen, the application freezes for several seconds and becomes unresponsive. After this delay, the LoginActivity finally appears. I investigated with logs and discovered that SplashActivity is executing in the background, but the Splash UI isn't visible during this freeze period. When I removed the Splash API completely, the app works smoothly without freezing, but now I'm showing two splash screens (which Google warns against in their guidelines). Here's my implementation:

@Override
protected void onCreate(Bundle savedInstanceState) {
    SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
    super.onCreate(savedInstanceState);
    splashScreen.setKeepOnScreenCondition(() -> true);
    // Service call
    // Gets the service data and navigates to Login (SplashActivity -> LoginActivity)
}

I expected the app to show the splash screen smoothly when reopening, the same way it does on the initial launch. I'm looking for a solution that allows me to use the Splash API correctly while avoiding the freezing issue when reopening the app after it's been force-closed.

发布评论

评论列表(0)

  1. 暂无评论