This is a migrated thread and some comments may be shown as answers.

How to Run my app in background.

14 Answers 357 Views
AppBuilder Windows client
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ajay
Top achievements
Rank 1
Ajay asked on 30 Jan 2014, 10:44 AM
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.

14 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 04 Feb 2014, 08:44 AM
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)
0
Ajay
Top achievements
Rank 1
answered on 04 Feb 2014, 09:27 AM
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
0
Warren
Top achievements
Rank 1
answered on 26 Feb 2014, 03:45 PM
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
0
Sulu
Top achievements
Rank 1
answered on 24 Apr 2014, 04:37 PM
Isn't a running background app a 'service' by definition?
0
Tina Stancheva
Telerik team
answered on 25 Apr 2014, 02:51 PM
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!

 
0
Nitesh
Top achievements
Rank 1
answered on 20 Jun 2014, 07:52 PM
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
0
Nitesh
Top achievements
Rank 1
answered on 20 Jun 2014, 07:54 PM
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
0
Tina Stancheva
Telerik team
answered on 25 Jun 2014, 04:31 PM
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!

 
0
xavy
Top achievements
Rank 1
answered on 10 Oct 2016, 06:33 PM
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
0
Preslav
Telerik team
answered on 13 Oct 2016, 02:57 PM
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.

 
0
Raj
Top achievements
Rank 1
answered on 17 Oct 2016, 11:44 AM
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

0
raj
Top achievements
Rank 1
answered on 19 Oct 2016, 05:21 AM

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?

0
Preslav
Telerik team
answered on 20 Oct 2016, 12:00 PM
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.

 
0
Xavy
Top achievements
Rank 1
answered on 16 Feb 2017, 08:20 PM
Good afternoon computer, I in android found the solution and has nothing to do with the telerik platform; Relatively this is focused on the use of plugin and handling of these for because I modify one that puts the application in the background .. but one thing is to be in the background and another that the functions in javascript are executed in time and form being in the background ; To obtain a more accurate solution modify a plugin that creates a service in to perform tasks in the background having as parameter date of realization; For example can be my application in the background and run ajax data send to web service / database every 10/15 minutes
Tags
AppBuilder Windows client
Asked by
Ajay
Top achievements
Rank 1
Answers by
Steve
Telerik team
Ajay
Top achievements
Rank 1
Warren
Top achievements
Rank 1
Sulu
Top achievements
Rank 1
Tina Stancheva
Telerik team
Nitesh
Top achievements
Rank 1
xavy
Top achievements
Rank 1
Preslav
Telerik team
Raj
Top achievements
Rank 1
raj
Top achievements
Rank 1
Xavy
Top achievements
Rank 1
Share this question
or