how to make an app run in background.

11 posts, 0 answers
  1. Ajay
    Ajay avatar
    22 posts
    Member since:
    Jun 2013

    Posted 13 Aug 2013 Link to this post

    hi, i want to update location information every n minutes, for this to happen my app must run in background(when the screen is off or other application is running) how to achieve this on android?

    thanks in advance
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 13 Aug 2013 Link to this post

    Hello Anup,

    To keep the app running in the background on Android, it’s necessary to acquire a partial wakelock (see android powermanager for more info). In Cordova, you need to use a plugin to achieve this and luckily there is already an existing Cordova plugin to do this. For more information on adding custom Cordova plug-in to Icenium, please see Working with Custom Plugins documentation section.

    Since the plug-in is currently not compatible with Cordova 2.7 and plugman specifications, you would have to modify it in order to be able to use it. We've already posted the instructions for the modification of this plug-in and the modified plug-in itself in this forum thread, so please review them carefully and follow the documentation instructions in Working with Custom Plugins help articles.

    Regards,
    Steve
    Telerik

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  3. Ajay
    Ajay avatar
    22 posts
    Member since:
    Jun 2013

    Posted 13 Aug 2013 Link to this post

    hi, thanks for quick reply.
    i tried downloading  zip but its been failed many times.
    now i got it downloaded but there is no plugin.xml file in the downloaded zip.

    thanks,
  4. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 13 Aug 2013 Link to this post

    Hello Anup,

    Yes, I've already mentioned that this plugin is not plugman compatible and also provided you with a link to an Icenium forum where we've already made it compatible. You can download the modified plugin from here.

    Regards,
    Steve
    Telerik

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  5. Ajay
    Ajay avatar
    22 posts
    Member since:
    Jun 2013

    Posted 13 Aug 2013 Link to this post

    hello steve.
    ya after importing that plugin its giving build failed error.
    have modified plugin.xml as suggested in childbrowser example.

    thanks
  6. Ajay
    Ajay avatar
    22 posts
    Member since:
    Jun 2013

    Posted 13 Aug 2013 Link to this post

    yes build succeeded ..
    how to check in device whether its running in background.
  7. Ajay
    Ajay avatar
    22 posts
    Member since:
    Jun 2013

    Posted 13 Aug 2013 Link to this post

    hi,
    thanks for the help steve, its working now.
  8. Warren
    Warren avatar
    61 posts
    Member since:
    Aug 2013

    Posted 04 Oct 2013 Link to this post

    Anup, how did that plugin work for you? I am just not trying Icenium and love that a plugin for this is available.

    Question - does this only work on Android? What about an iPhone or iPad?

    Thanks,

    Warren
  9. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 07 Oct 2013 Link to this post

    Hello Warren,

    The PowerManagement plugin is available for iOS as well and has already been updated to be compatible with Apache Cordova 3.0.0. You can get the latest version for iOS from here

    To update the plugin in your project, just replace the existing plugin files with the updated ones. Make sure to make any necessary modifications in the code, including any references. The quickest way to do that is as follows:

    1. Download the plugin and if not already archived, zip it.
    2. In Icenium, in the Project Navigator, expand the Plugins folder and delete the subfolder for your plugin.
    3. Add the updated custom plugin as per these instructions.

    Note that plugin.xml has been updated and the plugin script is declared in a <js-module> element and you do not need to make any <script> references in your code.

    We have verified that you can build the updated iOS plugin against Cordova 3.0.0 projects. We have not verified if the plugin functionality works as expected.

    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  10. Zinc
    Zinc avatar
    23 posts
    Member since:
    Aug 2013

    Posted 14 Jul 2014 Link to this post

    How does this solve the original question?  I want to call a javascript function every n minutes which queries a web service, but how does this work with this plugin when running in the background?
  11. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 17 Jul 2014 Link to this post

    Hi Zinc,

    Perhaps you could benefit from the Background Fetch plugin. You can check the articles, here in order the find out how to work with custom Cordova plugins.

    I hope that helps. Please, let me know if this is not what you are looking for and I will try to assist you further.

    Regards,
    Kaloyan
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
Back to Top