Can't pass geolocation object with Meteor.call (but anything else works!)

@mbrookes I’m working on a new background geolocation plugin that i’m using currently in production, which would fit your use case. I’ve been dragging my feet getting it up to speed for general use, but maybe i’ll work on it this weekend and get it ready for general consumption.

1 Like

@pmwisdom, that sounds fantastic, thanks! If there’s anything I can do to help (testing, documentation, pizza :pizza: ! ) let me know!

Thanks for the offer! You can definitely help with testing if you’d like. I had some time today to generalize it. This isn’t an official release and I will be making an atmosphere package at point, but if you’d like you can get a head start and test it out in your application. Let me know if you have any questions.

Cheers!

1 Like

Thanks - dumb question, how do I install a cordova plugin in Meteor that isn’t on NPM?

This specific one:

meteor add cordova:org.flybuy.cordova.background-location-services@https://github.com/pmwisdom/cordova-background-location-services.git#95a2f9245f2bb230fb8fc508499360c9031dac38

Hi Paul,

Finally getting around to looking at this, sorry! Am I understanding correctly that for Android, it needs to have an always-on connection to post to a server?

Thanks,
Matt.

Yep that is correct. I’m working on getting android callbacks to work right now and also there will be local storage once I get around to it. But for now, posting is the only option for android.

Okay, understand. Thanks for sharing your hard work on this!

I’m aiming for “offline first” given the patchy cell coverage outside of urban centers. I’m also developing for Android initially, for better or worse… (lowest common denominator in terms of relative performance).

I’ll keep an eye out for updates. :relaxed:

@mbrookes Well it took me a damn while but I finally got android callbacks to work 100% of the time. You can FINALLY register for updates just like iOS. Check it out if yah like =).

meteor add cordova:org.flybuy.cordova.background-location-services@https://github.com/pmwisdom/cordova-background-location-services.git#364d6c54042d004c734996ba528d21818392e12f

Thanks @pmwisdom. I gave it a go, but got:

Errors executing Cordova commands:         
                                              
   While running Cordova app for platform Android with options --device:
   Error: Command failed: /Users/matthew.brookes/Projects/meteor-background-gps/.meteor/local/cordova-build/platforms/android/cordova/run
   --device
   FAILURE: Build failed with an exception.
   
   * What went wrong:
   A problem occurred configuring root project 'android'.
   > Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.google.android.gms:play-services-location:+.
   Searched in the following locations:
   https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/maven-metadata.xml
   https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/
   file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-location/maven-metadata.xml
   file:/usr/local/opt/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-location/
   Required by:
   :android:unspecified

Let me know if you need more verbose debugging output.

Looks like you don’t have the play-services library for android. You need to go into your android sdk manager -> scroll down to “Extras”, click on the Google Play services option and click install.

I’ll have to put that in the docs!

http://developer.android.com/sdk/installing/adding-packages.html

You were right, I didn’t.

I installed it, but it still can’t find it.

google_play_servies is installed here:

/usr/local/opt/android-sdk/extras/google/google_play_services/

I was going to try symlinking to the directory it’s looking for, but there is no play-services-location' ingoogle_play_services`…

Try this,

cd to your .meteor folder in /Users/[Your-Name]/.meteor/android_bundle/android-sdk
run 'android’
see if google play services is installed there, if its isnt, install it.

Then check your $ANDROID_HOME
’echo $ANDROID_HOME’

Mine is actually pointing to that folder location above.

I don’t think ~/.meteor/android_bundle is used with Metoer 1.2+, but I went ahead and ran tools/android from there, and installed google play services, but ended up with exactly the same in extras/google as in my default $ANDROID_HOME:

$ ls -l  extras/google/google_play_services/
total 40
drwxr-xr-x   6 mbrookes  staff    204 30 Oct 01:00 docs
drwxr-xr-x   3 mbrookes  staff    102 30 Oct 01:00 libproject
drwxr-xr-x  12 mbrookes  staff    408 30 Oct 01:00 samples
-rw-r--r--   1 mbrookes  staff  16747 30 Oct 01:00 source.properties

You should be looking in extras/android/m2repository/com/google/android/gms/play-services-location/. Not extras/google/google_play_services/.

I would look, but that directory doesn’t exist :smile:

Haha well thats no good. Just for shits, try and install Google Repository, and Android Support Repository And Android Support Library, which are also in the extras part of the android-sdk manager. I may have forgotten which one includes the play -location

Okay, thanks - I’ll install them one at a time so we can see which one has it.

Edit: It was Google Repository.

I’ll let you know how it goes!

1 Like

Success! :tada:

Thanks for your help, and for putting this out there. I’ll let you know how it goes!

Hmm… For some reason I’m only getting a location update each time the app is put into the background, but not while it’s in the background - unless I toggle location off and on in settings, which causes a single location update.