How to Run my app in background.

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

    Posted 30 Jan 2014 Link to this post

    Hi Team,
        I want to update location information every 'n' minutes, so have set the time interval to execute the function after 'n' minutes.
    it works fine if the app is in active state,if the app is in background its not working.
    have used power management plugin also,it makes the device awake only if am running my app, if i switch to other apps it no longer works.


    Thanks in advance.
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 04 Feb 2014 Link to this post

    Hello Anup,

    We've already discussed with you a possible solution how to achieve such functionality in this forum thread. The PowerManagement plugin is 3rd party software and we have not invested much time testing it, but we see that there is a newer version since we initially suggested using it. Please upgrade the plugin to the latest version and see if that makes a difference.

    If the problem persists and you believe this is a problem with the plugin functionality, please contact the author directly in the plugin repository.

    Regards,
    Steve
    Telerik
    Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
  3. Ajay
    Ajay avatar
    22 posts
    Member since:
    Jun 2013

    Posted 04 Feb 2014 in reply to Steve Link to this post

    Hello Steve,
    Thanks for the reply.
     yes i have updated PowerManagement plugin. but  PowerManagement only avoids device from going to sleep mode .
    If user press home button, application will go to background and stops running javascript. My requirement is to get the location information even if the app is in background  or device in sleep mode. how do i achieve this.

    Thanks
  4. Warren
    Warren avatar
    61 posts
    Member since:
    Aug 2013

    Posted 26 Feb 2014 Link to this post

    Hi Anup,

    Did you figure out how to get it to run in the background the entire time and still run the code to update the gps?

    Thanks,
    Warren
  5. Sulu
    Sulu avatar
    34 posts
    Member since:
    Aug 2013

    Posted 24 Apr 2014 in reply to Ajay Link to this post

    Isn't a running background app a 'service' by definition?
  6. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 25 Apr 2014 Link to this post

    Hello Sulu,

    The terminology as well as the approach for running background tasks really depends on the OS specifics. In Android in order to perform a ling running task in the background, you need to create a service. However, in the context of iOS a long running task can be implemented in the background by an app running in the background but only in case that this app meets the requirements for running without being suspended.

    Regards,
    Tina Stancheva
    Telerik
     

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

     
  7. Nitesh
    Nitesh avatar
    3 posts
    Member since:
    Feb 2014

    Posted 20 Jun 2014 in reply to Steve Link to this post

    Hello steve i have this plugin. https://github.com/Viras-/cordova-plugin-powermanagement but i am not getting how to use this . can you give me any sample example for using this plugin.

    thankx advance
  8. Nitesh
    Nitesh avatar
    3 posts
    Member since:
    Feb 2014

    Posted 20 Jun 2014 in reply to Ajay Link to this post

    i also want to do same like that , if you get the answer then please let me know i am working for good cause . my email id is- cresolnitesh@gmail.com 

    thanx advance anup
  9. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 25 Jun 2014 Link to this post

    Hello,

    We don't have a sample project demonstrating how to use the PowerManagement  plugin you mentioned. However, in order to integrate it in an AppBuilder project, you can download it as a zip from its repository and then follow the steps outlined in the Import Custom Plugins tutorial.

    Once imported, the plugin allows you to invoke the following methods:
    • powerManagement.acquire(onSuccess, onError,runLockScreen); -  acquire a new wake-lock to keep device awake
    • powerManagement.release(onSuccess, onError); - release the wake-lock
    • powerManagement.dim(onSuccess, onError); - acquire a partial wake-lock, allowing the device to dim the screen
    If you need any further information on how these methods work on each device, you can follow the links provided by the plugin author in its repository:
    If you encounter any issues with the plugin, I would also recommend that you share them with the plugin authors as they might be able to better assist you in resolving them.

    Regards,
    Tina Stancheva
    Telerik
     

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

     
  10. Javier
    Javier avatar
    2 posts
    Member since:
    Jul 2016

    Posted 10 Oct Link to this post

    I have the same problem, my application has a function in js that if the application is closed function stops working and that is not feasible; therefore we need a plugin that poueda leave the application in the background
  11. Preslav
    Admin
    Preslav avatar
    50 posts

    Posted 13 Oct Link to this post

    Hello Javier,

    A possible solution is to use the Cordova Background mode plugin. This plugin prevents the application from going to sleep while in the background. More information on how to use the plugin is available here.

    Additionally, I was able to successfully include, deploy and use the above plugin in an AppBuilder Cordova project. I am attaching the sample project to this message for your reference.

    I hope this helps.

    Regards,
    Preslav
    Telerik by Progress
     

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

     
  12. Raj
    Raj avatar
    1 posts
    Member since:
    Sep 2016

    Posted 17 Oct in reply to Preslav Link to this post

    Hi Presalv, 
    Thanks for your reply,
    Iam new for create hybrid app, I facing problem on creating Background service, I saw your post and i use your files,Its showing error on 


    ERROR
    The key "target-densitydpi" is not supported. at index.html (line: 24)
    Received Event: deviceready at js/index.js (line: 57)
    Uncaught TypeError: Cannot read property 'backgroundMode' of undefined at js/index.js (line: 39)


    I using visuval studio+Telerik app builder for creating Hybrid app
    Below here i attach my code Pls look at it and reply me, thanks

  13. raj
    raj avatar
    1 posts
    Member since:
    Oct 2016

    Posted 19 Oct in reply to Preslav Link to this post

    Hi preslav's,

    Thanks for your post, Give code Blank3(BackGround Service) its only working on inside the app. When Exit its not working why?

  14. Preslav
    Admin
    Preslav avatar
    50 posts

    Posted 20 Oct Link to this post

    Hi Raj,

    From your second post, I understand that you have already managed to fix the error from the first one. Is that correct?

    The application is not supposed to work when the user force closes it, for example, by swiping it up on an iPhone. It should be working when the app is still running in the background.

    Regards,
    Preslav
    Telerik by Progress
     

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

     
Back to Top