keep device awake during splashscreen

6 posts, 0 answers
  1. Max
    Max avatar
    19 posts
    Member since:
    Jan 2015

    Posted 22 Mar 2015 Link to this post

    i am using a hybrid app that shows the splashscreen on startup, however on some low end devices it takes significant time to load, which is fine too.
    however, if the device has a low screen off time, it just shuts off during loading the app.

    i know about the insomnia plugin, but this can only be invoked after cordova has fully loaded and thus not when the splashscreen is shown.

    is there any switch or modification thats sets a wakelock or keeps the screen on during initilization of the app where only the splashscreen is shown?
  2. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 25 Mar 2015 Link to this post

    Hi Max,

    I don't think this is possible in hybrid applications. This is because, in order to keep the device awake you will need to invoke native APIs and for such calls you will need Cordova, as that's what handles all the plugins and native hooks. Unfortunately, most of the time during the splashscreen is spent in the Cordova initialization, so there is no way (I can think of) to prevent device sleep.

    Still, there might be a way to work around the issue by optimizing the initialization of the application. I would suggest you to check what is taking most time and investigate why this is happening. Further, you should know that Cordova is fully initialized after the deviceready event, so there might be a way to move some of the other logic behind in the initial start.

    I hope this helps.

    Regards,
    Kaloyan
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  3. Max
    Max avatar
    19 posts
    Member since:
    Jan 2015

    Posted 26 Mar 2015 in reply to Kaloyan Link to this post

    that is why i was hoping for some kind of switch or modification to the splashscreen plugin, which seems to only use native methods as it works before cordova is fully loaded.

    however, it is only the case on first app start where it seems to take forever on some low end devices.
    any additional start does not take that huge amount of time to load, also there is not much going on, before the deviceready event is fired.
  4. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 31 Mar 2015 Link to this post

    Hi Max,

    You can further check if there are any unused plugins enabled in the project. If so, disabling them could drastically decrease the initialization time of your app. You will find a list of all enabled/disabled plugin in the Plugins tab of your project's properties.

    I hope this helps.

    Regards,
    Kaloyan
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  5. Max
    Max avatar
    19 posts
    Member since:
    Jan 2015

    Posted 05 Apr 2015 Link to this post

    already optimized the plugin list and currently only use the necessary cordova plugins.

     for testing i also completely disabled all cordova plugins and the first start still takes significantly longer than any of the following starts, even if the app is no longer in memory.

    however this only applies to low end android devices, neither iOS nor WP have this drastic difference in app start performance.

    the affected low end devices are mainly still on Android 2.3.x, which is still used by quite a lot of users, appearently i have no access to "higher end" devices still running this old android version to determine if it is the os version or just these old devices themselves ...

    guess this is just the way that low end devices are really slow nowadays

  6. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 08 Apr 2015 Link to this post

    Hi again Max,

    Indeed, the issue could be due to Android 2.2.x in a combination with the device's hardware. Please, try with newer Android device, if you have a chance and let us know if the issue is present there as well.

    Regards,
    Kaloyan
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
Back to Top