Code Monkey home page Code Monkey logo

Comments (5)

alexandreetf avatar alexandreetf commented on September 26, 2024

My Log console shows:
04-05 22:57:51.502: I/ActivityManager(916): Waited long enough for: ServiceRecord{582d1f6 u0 com.ionicframework.back546619/com.red_folder.phonegap.plugin.backgroundservice.sample.MyService}

from bgs-core.

Red-Folder avatar Red-Folder commented on September 26, 2024

Reference your questions;

Reference question 1;
Yes, the RegisterForUpdate will be disabled. The app can only be registered for updates during it's lifetime. If you close the app, then it is no longer alive and thus cannot receive automatic updates from the background service.

In a production application, you would automatically register for updates when the App starts. For the sample application I make it all manual so that the developer can see the moving parts.

Reference question 2 - part a - Service doesn't start in boot;
Add Log.d() statements to the BootReceiver.java or run in debug (Log.d will probably be easier). This will help us to understand what is happening on boot. I've tested on Android 5 (emulator & device) and both worked fine. I would suspect that there is something within the start up of the background service which is taking too long start - you will need to review your code.

Reference question 2 - part b - Recommendation on persistent storage;
The documentation is telling you to use persistent storage for any configuration you use for the background service (either via getConfig/ setConfig or just in your Java code).

The myService sample just uses in-memory variables - so when the service restarts (such as from boot) then it will have lost those in-memory variables.

In production code, any of those variables should be saved to persistent storage (such as shared preferences, SQLite, etc) - so that when the service starts it can read those details back in to the variables.

I hope that all makes sense.

from bgs-core.

Red-Folder avatar Red-Folder commented on September 26, 2024

No further activity - assume question closed

from bgs-core.

ZengYJ avatar ZengYJ commented on September 26, 2024

Hi.
I installed bgs-sample.But The service is not started after device reboot.And I add Log.d in BootReceiver but there is no related any messages in logcat. pls give some help or suggestions. Thks.

from bgs-core.

Red-Folder avatar Red-Folder commented on September 26, 2024

@ZengYJ Please do not update closed un-related issues. If you have a new issue to raise, then please create a new one. In the case of you problem - make sure that you have registered it to receive the BootReceive broadcast in the manifest

from bgs-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.