yayaa / LocationManager

Simplify getting user's location for Android
807 stars 187 forks source link

Support for API 10 #9

Closed Goutte closed 8 years ago

Goutte commented 8 years ago

Is the API 14 a hard requirement ? Would it be possible, without too much work, to make this library compatible with API 10 ? What features would we lose ?

I'll clone it and dabble with it, but not knowing its codebase at all I felt like I should ask first so as not to run into walls after hours of work, as usual.

This lib looks like the best and most extensive location lib for android ! Congrats !

Goutte commented 8 years ago

The Sample app uses

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.yayandroid:LocationManager:1.1.1'
}

So gradle will fetch 'com.yayandroid:LocationManager:1.1.1' online.

I thought it would use the local sources in Library, for development convenience. I'm rather new to both java and android, I don't know what the usual practice is.

I opened the Library dir in its own Android Studio instance, tried to generate a jar file (which i could then monkey-include in the Sample app, just to get things running), but no joy here either. Best i could do was to generate LocationManager/Library/app/build/outputs/aar/app-debug.aar.

I guess you did not include documentation on how to help with development of this lib because it's standard android practice, but I'm lost ; and the net is of no help either. I tried all the keywords I could think of. I'll probably figure a way to make this work in a few hours or days, but if you have tips/links on how to do this the right way, I'm all for it !

Goutte commented 8 years ago

I thought I was clever when I added

compile files('../Library/app/build/outputs/aar/app-debug.aar')

But, of course, it won't accept aar :

Error:Project app: Only Jar-type local dependencies are supported..

Goutte commented 8 years ago

Ok, I managed to launch the Sample app with

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.android.support:appcompat-v7:23.4.0'
    compile project(':locationmanager')
}

And in settings.gradle :

include ':app', ':locationmanager'
project(':locationmanager').projectDir = new File('../Library/app')

But I had to remove apply from: '../maven_push.gradle' from Library/app/build.gradle.


I have no idea why I had to jump through so many hoops, but who cares ? It works ! I set minSdkVersion 10 and the sample app runs just fine, as far as I can see.

So I'm getting back to my initial question : why 14 ?

Goutte commented 8 years ago

Note that on my hardware phone running API 10, using .askForGooglePlayServices(true) is quirky ; it sometimes crashes google services (but not our app). But with that set to false, everything runs just fine.

Goutte commented 8 years ago

If anyone else wants support for API 10, just add the following to your gradle config :

repositories {
    // ...
    maven { url "https://jitpack.io" } // to get from github tags
}
dependencies {
    compile 'com.github.Give2Peer:LocationManager:1.1.1-api10'
    // ...
}

Works for me.

yayaa commented 8 years ago

Hi @Goutte,

Sorry for leaving you all alone on this topic, but i was in vacation and couldn't look here.

Actually the reason of why the library supports 14+ is that Google Developers / Advocates suggests that way and since dashboard shows that there are so less devices which run older versions and also we need to stop supporting former versions at some point :) I didn't even bother to test the library with former versions but i would say with its powerful configuration design it would be possible to launch it on those versions as well, since it's not using any new feature requirements. (But you also realised that :))

And yes, indeed i should've put library folder into sample to make development easier on it, but because i created this library as a whole project first and splitted into lib/sample i didn't consider it. My bad!

Finally i am glad that you found your way out, and thanks for the compliment :)