Code Monkey home page Code Monkey logo

Comments (11)

thiagomotta avatar thiagomotta commented on June 25, 2024

?

from bgs-core.

Red-Folder avatar Red-Folder commented on June 25, 2024

Sorry, I hadn't noticed your issue.

I'll have to have a dig through the code, but the most obvious thing would be to add some logging to the register function (within BackgroundService.java) if there isn't already any in there. Then add additional logging to the Boot Receiver.

from bgs-core.

Red-Folder avatar Red-Folder commented on June 25, 2024

Had a quick look at the code;

Within BootReceiver.java add some Log.d statements to show if the onReceive method is actually hit.

Potentially worth also adding Log.d statements to the PropertyHelper.java in getBootServices, addBootService and isBootService. These methods are responsible for saving & retrieving if it should shouldn't start on boot.

Then use the log cat to check firstly that the boot start is being set, then secondly that the BootReceiver is called when the device starts and then that is attempts to start the service.

from bgs-core.

thiagomotta avatar thiagomotta commented on June 25, 2024

Thank you,
I will add these logs and call you back with the result.
I am new to phonegap, how do I get the logs generated by code. Java?

from bgs-core.

Red-Folder avatar Red-Folder commented on June 25, 2024

Ok - that is a steep learning curve. You need to learn how to develop Android application using Eclipse & Java.

I'd suggest learning these things (searches on google will prove better than me trying to explain them) - assuming you haven;t already:

  1. Install Android Developer kit
  2. Install Eclipse
  3. Find tutorial to build an Android native app using Eclipse
  4. Practice running your native app within the Android emulator
  5. Learn how to attach the "logcat" window in Eclipse to the Android emulator. The logcat screen will display all the log messages from the emulator (or connected physical device if you do correctly).
  6. Look up Log.d java command which will write a debug message to the logcat window.
  7. Learn how to use the filtering within the logcat window to just see your app

Once happy with the above, then come back to your phonegap application and use the skills you've learnt to use the logcat to diagnose the problem within your app. You may see a warning or an error in the logcat if you javascript is badly formed. If not, then you'll want to look for the debug messages (my code is fairly saturated with Log.d statements).

If still getting stuck, then post up the locat results.

from bgs-core.

thiagomotta avatar thiagomotta commented on June 25, 2024

Hi,
see who is giving the error.
Please can you help me?

java.lang.RuntimeException: Unable to instantiate service com.red_folder.phonegap.plugin.backgroundservice.RastreadorService: java.lang.ClassNotFoundException: Didn't find class "com.red_folder.phonegap.plugin.backgroundservice.RastreadorService" on path: DexPathList[[zip file "/data/app/tmz.rastreador-2.apk"],nativeLibraryDirectories=[/data/app-lib/tmz.rastreador-2, /vendor/lib, /system/lib]]
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2559)
at android.app.ActivityThread.access$1800(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5050)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:615)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.red_folder.phonegap.plugin.backgroundservice.RastreadorService" on path: DexPathList[[zip file "/data/app/tmz.rastreador-2.apk"],nativeLibraryDirectories=[/data/app-lib/tmz.rastreador-2, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2556)

from bgs-core.

Red-Folder avatar Red-Folder commented on June 25, 2024

It can't find the service name properly. Is it named correctly?

It this error occurring on boot.

from bgs-core.

thiagomotta avatar thiagomotta commented on June 25, 2024

image

from bgs-core.

thiagomotta avatar thiagomotta commented on June 25, 2024

This application I had first developed in java and eclipse, but then switched to html5. Ellipse in the logcat I've used without problems. I just did not know how to use logcat with phonegap. I just saw on google that I could run a "monitor" command and it will open the Android Debug Monitor

But thanks for your step by step
=)

ps.: Sorry, my english is not very good!

from bgs-core.

Red-Folder avatar Red-Folder commented on June 25, 2024

Sorry for the delay;

There is a difference in your package name at the top iof RastreaderService.java. Within the file it reads:

com.red_folder.phonegap.plugin.backgroundservice.services

Yet your folder structure and the error in the logcat seems to be expect it to be:

com.red_folder.phonegap.plugin.backgroundservice

Basically, remove the ".services" from your package name

from bgs-core.

Red-Folder avatar Red-Folder commented on June 25, 2024

No response since June - assumed closed

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.