jonasoreland / runnerup

A open source run tracker
GNU General Public License v3.0
753 stars 275 forks source link

Work without Google Play Services? #20

Closed jas4711 closed 9 years ago

jas4711 commented 10 years ago

This app seems to be exactly what I have been looking for -- and I would like to install it on my Samsung S3 which is running Replicany without any GAPPS stuff. However the app seems to depend on Google Play Services, which is a no-no for me. Would it be possible to relax this requirement so that it is an optional dependency? What does the app use Google Play Services for? Thanks in advance.

Btw, someone mentioned your app on the fdroid forum as well: https://f-droid.org/forums/topic/runnerup-an-open-source-run-tracker-for-android/

/Simon

jonasoreland commented 10 years ago

Hi Simon,

The Google Play Service is used to show maps inside the app. Removing that is easy, but not great. Remove hard dependency, and only show map if GPS is installed, is not super hard I think...

How does that sound ?

/Jonas

jas4711 commented 10 years ago

Removing the hard dependency would be a good first step -- I suppose it will require that you can build runnerup without linking to play services at all.

A next step would be to support some other way to display a map. I don't know how to do this technically, but it seems other apps have managed it, compare how MozStumbler now uses OSM: https://f-droid.org/forums/topic/mozstumbler/ Btw, speaking as an OSM-mapper, I'd prefer OSM to Google Maps any day since OSM is more accurate where I typically run. Maybe it could be a feature of the app to provide different map sources. It seems Mapbox may be involved in this: https://www.mapbox.com/ and in particular https://www.mapbox.com/blog/mapbox-android/

/Simon

jonasoreland commented 10 years ago

Hi Simon,

I took the time and tested RunnerUp on an (emulated) device without Google Play Services. It worked fine, except that it didn't show the map...

I think this qualifies as "Work without Google Play Services". And you can file a new issue to "Add support for OSM"

/Jonas

jas4711 commented 10 years ago

Thanks. I believe the critical aspect will be whether it is possible to build RunnerUp without the dependency at link-time, so that the fdroid people can distribute your app. But I will start to play with the code and see if I can get it to build and run on my device, for eventual inclusion into fdroid.

dalb8 commented 10 years ago

The Google Play Services library is a huge library so a free general replacement would be a huge undertaking. If the app were to build with Google APIs from the SDK instead, then you can just build it with https://github.com/mar-v-in/MapsAPI library and a normal SDK. This replaces Google Maps with OSM. It has difficulty centring the map on the user so a button should be included to do that manually. Also write sdcard permissions need to be granted.

Mapbox is all very well but they want API keys in the app. Thus the f-droid build of MozStumbler doesn't show any maps at all.

The regular way to go about it is to use the osmdroid and slf4j jars.

CharString commented 10 years ago

I'm ok with no map – I know where I am –, but does it still track my run, so I can export it?

jonasoreland commented 9 years ago

both this and #21 should be quite doable not that we have different build-flavors!

netmackan commented 9 years ago

I'm currently looking a bit on how to do different builds with and without Google services. Have I understood correctly that the two product flavors "froyo" and "latest" are their so the app can be built both with and without Wear support?

nebmo commented 9 years ago

Yes you are correct (froyo does not support wear)

netmackan commented 9 years ago

I'm trying to figure out how this build process with different source folders work but I think there is something strange with my set up.

Is it expected that out of the 3 source folders ("src", "froyo/java" and "latest/java") there is only packages for src and froyo visible in the IDE?

See the packages "org.runnerup" and "org.runnerup (froyo)" in the screenshot below:

runnerup-android-studio

netmackan commented 9 years ago

Never mind my last question. I now found the Build Variants tab (lower left in the screenshot) where I can change the active variant to "latest" and the source package then changes.

netmackan commented 9 years ago

I am experimenting with introduced a flavor dimension "map", with the "gmap" and "nomap" flavors (later an osmap one could potentially be added for #21). Currently the gmap flavors works to build but not yet the nomap ones as those requires some refactorings but that is just Java so shouldn't be a big problem.

The biggest issue at the moment though, is that all though both froyoGmap and latestGmap builds fine, Android Studio shows compilation errors in the editor. It seem it does not recognize the dependencies properly. Maybe the IDE does not support them being added within if-statements in build.gradle (?)

My branch is available here if anyone wants to have a look and has some ideas: https://github.com/netmackan/runnerup/tree/optional-gapps-build-1

I also have a branch where I simply patched away anything by Google here to later see what refactorings would be needed: https://github.com/netmackan/runnerup/tree/no-gapps-hack-1

jonasoreland commented 9 years ago

Hi,

i haven't checked your branch (yet)...but only want to provide some context. i think detecting presense of gapps in the app and choose map provider based which are present is fine.

however, the people at f-droid want to be able to build RunnerUp without gapps...and this is where the flavors would come into play.

/Jonas

On Fri, Apr 3, 2015 at 10:45 PM, Markus notifications@github.com wrote:

I am experimenting with introduced a flavor dimension "map", with the "gmap" and "nomap" flavors (later an osmap one could potentially be added for #21 https://github.com/jonasoreland/runnerup/issues/21). Currently the gmap flavors works to build but not yet the nomap ones as those requires some refactorings but that is just Java so shouldn't be a big problem.

The biggest issue at the moment though, is that all though both froyoGmap and latestGmap builds fine, Android Studio shows compilation errors in the editor. It seem it does not recognize the dependencies properly. Maybe the IDE does not support them being added within if-statements in build.gradle (?)

My branch is available here if anyone wants to have a look and has some ideas: https://github.com/netmackan/runnerup/tree/optional-gapps-build-1

I also have a branch where I simply patched away anything by Google here to later see what refactorings would be needed: https://github.com/netmackan/runnerup/tree/no-gapps-hack-1

— Reply to this email directly or view it on GitHub https://github.com/jonasoreland/runnerup/issues/20#issuecomment-89414064 .

bagage commented 9 years ago

@netmackan : what is the current status of this issue? This gradle flavor feature might do the trick, but what about Eclipse/ant? Will we definitively drop its support? @jonasoreland : is gmaps mandatory? Would not it be easier to drop gmaps support and instead fully use openstreetmap? Or is there any advantage to use gmaps that I do not see other than being already implemented :)?

jonasoreland commented 9 years ago

i don't know of any major advantage except being implemented...

On Mon, Jun 8, 2015 at 10:12 PM, Gautier Pelloux-Prayer < notifications@github.com> wrote:

@netmackan https://github.com/netmackan : what is the current status of this issue? This gradle flavor feature might do the trick, but what about Eclipse/ant? Will we definitively drop its support? @jonasoreland https://github.com/jonasoreland : is gmaps mandatory? Would not it be easier to drop gmaps support and instead fully use openstreetmap? Or is there any advantage to use gmaps that I do not see other than being already implemented :)?

— Reply to this email directly or view it on GitHub https://github.com/jonasoreland/runnerup/issues/20#issuecomment-110123651 .

dalb8 commented 9 years ago

There isn't that much advantage to using GMS: see microg/android_packages_apps_UnifiedNlp#36

netmackan commented 9 years ago

@bagage The status from my side is that I have created a branch (https://github.com/netmackan/runnerup/tree/optional-gapps-build-1) where I have implemented the idea of having new build flavor dimension for the type of map implementation with different source folders for the respective one. This would allow us to then refactor the code to still have the gmaps support while also being able to build without any map as a first step to get the builds on f-droid. Then later one could also add support for other map implementation and then either continue with the different versions or decide to switch to use only a non-gmaps one.

All though building the different versions of the app seems to work fine switching between the different flavors in the Android Studio IDE was not always reliable. I will try again and see if the issue is still present but as I remembered it, after switching from one flavor to an other the dependencies of the previous was (sometimes?) still in affect which for instance could show compilation errors in the source code editor at the same time building still worked...

I haven't considered Eclipse, mainly because I don't use it myself and as the README suggested the build wasn't working anyway. For NetBeans IDE there is a nice Android/Gradle plugin that can be used. Maybe there eventually (or already is) something similar for Eclipse?

netmackan commented 9 years ago

Upgraded Android Studio to 1.2.2 but still it seems the compile time dependencies was not picked up by the editor. It could be something other that is wrong with the Gradle parts as well.

Unless somebody else sees what I am doing wrong, maybe switching directly to OSM would be easier.

bagage commented 9 years ago

@netmackan OK thanks for the status point.I think I will directly drop google maps support and we will only use OSM provider in the future.

patcon commented 9 years ago

Hey all, this is all really exciting developments, but would it be sensible to move discussion of FOSS map replacements into https://github.com/jonasoreland/runnerup/issues/21, and leave this for discussion of stripping enough to get things building on F-Droid? Just to keep issues focussed :)