Issues with Android Splash API - Stack Overflow

I'm experiencing problems with the Android Splash API. The scenario is as follows:When I first la

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744273643a4566223.html

相关推荐

  • Issues with Android Splash API - Stack Overflow

    I'm experiencing problems with the Android Splash API. The scenario is as follows:When I first la

    7天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信