Code Monkey home page Code Monkey logo

Comments (3)

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

Sorry, which part isn't working?

I had a quick look at your code, but couldn't understand what you where executing in the background

from bgs-core.

mongkol38 avatar mongkol38 commented on September 28, 2024

Hello Mark Taylor,
About my app, my friend make his app using mobile web you can see at
http://www.psschool.in.th ,
He want to build his app to android application and has more feature Ex,
push notification, badge number and more.
So, I used cordova to build android application from his mobile web.

The first version I build app with cordova and add these plugin.

  1. push notification I used this plugin -->
    https://github.com/phonegap-build/PushPlugin

  2. and open the web http://www.psschool.in.th I used this plugin -->
    https://github.com/apache/cordova-plugin-inappbrowser

  3. I get the app version by this plugin -->
    https://github.com/whiteoctober/cordova-plugin-app-version

  4. and alert message using this plugin -->
    https://github.com/apache/cordova-plugin-dialogs

  5. and check the internet connection using this plugin -->
    https://github.com/apache/cordova-plugin-network-information

    About this app,
    When start app my app will check the internet connection using plugin
    cordova-plugin-network-information,

    • if can't connect to internet my app alert message using plugin
      cordova-plugin-dialogs
    • if internet connection is connected
      - my app will get app version using plugin
      cordova-plugin-app-version
      - my app register PushPlugin
      - my app open http://www.psschool.in.th using plugin
      cordova-plugin-inappbrowser
      Everything can work, my app can run success with push notification. and
      run on android 4.0+.

    After that he want to show the badge number on the app icon in android (
    look like icon on iphone or Line icon when push message come in ). In this
    case I use this method to solve problems.,

  6. I used your plugin to build the background process for get the badge
    number from server every 3 sec.

  7. Then I used this plugin https://github.com/katzer/cordova-plugin-badge
    to show the badge number on the app icon

    Everything can work as well, But when I exit my app I can't get the
    badge number from server every 3 sec. but the PushPlugin can work after
    exit the app (after exit the app, I send message , my app can push
    notification),
    In this case I test by create new simple cordova project with your
    sample -->
    https://github.com/Red-Folder/bgs-core/wiki/Using-the-MyService-Sample and
    add this plugin --> https://github.com/apache/cordova-plugin-dialogs to
    beep every 3 sec. Everything ok when i open app or minimize app the beep is
    on but when exit app the beep is off.

    Please help or recommend me how to do.
    How to build the background process can get the badge number from server
    after exit the app look like PushPlugin. (for simple case the beep is on
    every 3 sec. after exit app)
    And I attach my index.html file to your e-mail.

    I apologize if my English skill is not good.

    Thank you for your advice.

from bgs-core.

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

I believe the problem is that your logic relies on JavaScript to complete the work. JavaScript is only available to you when the app is running.

Cordova/ Phonegap app is providing a container in which JavaScript (and plugins) can run. Without it running you cannot use JavaScript (or other plugins).

BGS-Core allows you to extend the BackgroundService class in Java (different from JavaScript). Putting your functionality into the doWork() method of the class will allow it to run without Cordova/ Phonegap because it is using Java (not JavaScript). When doing this you are effectively natively programming an Android app.

To reiterate, when the app is closes, the background service has no access to:

  • Cordova/ Phonegap functions or plugins
  • JavaScript

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.