Giter Club home page Giter Club logo

smart-location-lib's People

Contributors

0x7067 avatar arayray avatar c0state avatar elevenfive avatar eric-jalal avatar irfaan008 avatar ivanosh avatar juanmatm82 avatar jvartanian avatar lebeshev avatar lyoness avatar mrmans0n avatar mtrakal avatar ofirmiron avatar tk120404 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smart-location-lib's Issues

Crash: NoClassDefFoundError: com.google.android.gms.location.LocationClient

Crashed in Emulator with Android 4.4.2 without Google API. Library version is 2.0.8.

01-07 11:32:17.158 2449-2449/com.trukom.livegps E/SmartLocationOptions﹕ GMS not found or there were errors connecting. Disabling fused providers and activity recognizers to avoid app-breaking exceptions
01-07 11:32:17.158 2449-2449/com.trukom.livegps E/dalvikvm﹕ Could not find class 'com.google.android.gms.location.LocationClient', referenced from method io.nlopez.smartlocation.SmartLocationService.initLocation
01-07 11:32:17.158 2449-2449/com.trukom.livegps W/dalvikvm﹕ VFY: unable to resolve new-instance 4252 (Lcom/google/android/gms/location/LocationClient;) in Lio/nlopez/smartlocation/SmartLocationService;
01-07 11:32:17.158 2449-2449/com.trukom.livegps D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0000
01-07 11:32:17.158 2449-2449/com.trukom.livegps I/dalvikvm﹕ Could not find method com.google.android.gms.location.LocationClient.isConnected, referenced from method io.nlopez.smartlocation.SmartLocationService.startOldSchoolLocation
01-07 11:32:17.158 2449-2449/com.trukom.livegps W/dalvikvm﹕ VFY: unable to resolve virtual method 28692: Lcom/google/android/gms/location/LocationClient;.isConnected ()Z
01-07 11:32:17.168 2449-2449/com.trukom.livegps D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x005b
01-07 11:32:17.168 2449-2449/com.trukom.livegps I/dalvikvm﹕ Could not find method com.google.android.gms.location.LocationClient.isConnected, referenced from method io.nlopez.smartlocation.SmartLocationService.startLocation
01-07 11:32:17.168 2449-2449/com.trukom.livegps W/dalvikvm﹕ VFY: unable to resolve virtual method 28692: Lcom/google/android/gms/location/LocationClient;.isConnected ()Z
01-07 11:32:17.168 2449-2449/com.trukom.livegps D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0016
01-07 11:32:17.168 2449-2449/com.trukom.livegps I/dalvikvm﹕ Could not find method com.google.android.gms.location.LocationClient.isConnected, referenced from method io.nlopez.smartlocation.SmartLocationService.startLocation
01-07 11:32:17.168 2449-2449/com.trukom.livegps W/dalvikvm﹕ VFY: unable to resolve virtual method 28692: Lcom/google/android/gms/location/LocationClient;.isConnected ()Z
01-07 11:32:17.168 2449-2449/com.trukom.livegps D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x004e
01-07 11:32:17.168 2449-2449/com.trukom.livegps I/dalvikvm﹕ Could not find method com.google.android.gms.location.LocationClient.isConnected, referenced from method io.nlopez.smartlocation.SmartLocationService.stopLocation
01-07 11:32:17.168 2449-2449/com.trukom.livegps W/dalvikvm﹕ VFY: unable to resolve virtual method 28692: Lcom/google/android/gms/location/LocationClient;.isConnected ()Z
01-07 11:32:17.168 2449-2449/com.trukom.livegps D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
01-07 11:32:17.168 2449-2449/com.trukom.livegps D/dalvikvm﹕ DexOpt: unable to opt direct call 0x7011 at 0x02 in Lio/nlopez/smartlocation/SmartLocationService;.initLocation
01-07 11:32:17.168 2449-2449/com.trukom.livegps D/AndroidRuntime﹕ Shutting down VM
01-07 11:32:17.168 2449-2449/com.trukom.livegps W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb2d2eb20)
01-07 11:32:17.198 2449-2449/com.trukom.livegps D/dalvikvm﹕ GC_FOR_ALLOC freed 292K, 10% free 3421K/3768K, paused 16ms, total 17ms
01-07 11:32:17.198 2449-2449/com.trukom.livegps E/com.trukom.logger.LoggerHelper﹕ Uncaught exception
java.lang.NoClassDefFoundError: com.google.android.gms.location.LocationClient
at io.nlopez.smartlocation.SmartLocationService.initLocation(SmartLocationService.java:90) ~[na:0.0]
at io.nlopez.smartlocation.SmartLocationService.onCreate(SmartLocationService.java:75) ~[na:0.0]
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2572) ~[na:0.0]
at android.app.ActivityThread.access$1800(ActivityThread.java:135) ~[na:0.0]
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) ~[na:0.0]
at android.os.Handler.dispatchMessage(Handler.java:102) ~[na:0.0]
at android.os.Looper.loop(Looper.java:136) ~[na:0.0]
at android.app.ActivityThread.main(ActivityThread.java:5017) ~[na:0.0]
at java.lang.reflect.Method.invokeNative(Native Method) ~[na:0.0]
at java.lang.reflect.Method.invoke(Method.java:515) ~[na:0.0]
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) ~[na:0.0]
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) ~[na:0.0]
at dalvik.system.NativeStart.main(Native Method) ~[na:0.0]
01-07 11:32:17.208 2449-2449/com.trukom.livegps E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.trukom.livegps, PID: 2449
java.lang.NoClassDefFoundError: com.google.android.gms.location.LocationClient
at io.nlopez.smartlocation.SmartLocationService.initLocation(SmartLocationService.java:90)
at io.nlopez.smartlocation.SmartLocationService.onCreate(SmartLocationService.java:75)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2572)
at android.app.ActivityThread.access$1800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
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:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)

IllegalArgumentException: provider==null

sometimes there is IllegalArgumentException: provider==null

error occurs on older devices

java.lang.IllegalArgumentException: provider==null
at android.location.LocationManager.isProviderEnabled(LocationManager.java:1136)
at io.nlopez.smartlocation.SmartLocationService.startOldSchoolLocation(SmartLocationService.java:161)
at io.nlopez.smartlocation.SmartLocationService.access$200(SmartLocationService.java:27)
at io.nlopez.smartlocation.SmartLocationService$1.run(SmartLocationService.java:137)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5071)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)

callback no gps

i've opened new issue because you don't answer me, maybe you hadn't seen my question in a closed issue.

How can i use that callback??

SmartLocation.with(QuiApi.getInstance().getApplicationContext()).location().oneFix()
                .start(new OnLocationUpdatedListener() {
                    @Override
                    public void onLocationUpdated(Location location) {
                        findPromotion(null, 0, location.getLatitude(), location.getLongitude(), callback);
                    }
                });

here i haven't any other callback, 've updated library.

@mrmans0n

IMO callback can be implemented in start() method.
In OnLocationUpdatedListener() add new callback onPlayServicesNotInstalled, OnLocationServicesDisabled and OnGPSDisabled, so when we call that method we have more possibilities to handle situation. I've tried to add this new feature but when i open your project i get an error in gradle

Error:(83, 0) No such property: sonatypeRepo for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer

and MavenDeployment is red. If you tell me how can i resolve this error i can do a pull request, because is very simple to do. I've a custom lib to do this and do that what i tell you, but i prefer use this because is more complete.

Thank you.

provider

If location services are enabled or disabled custom provider fall always in onConnected() and onResult(Status status) with status success. so i can't handle location services disable situation. is there another way to do this or it is an error?

Location settings popup if location is disabled.

Hello,

Thanks for this awesome library.

Any chance to have the functionality to show Location Settings Dialog if device's location services are disabled?

I found this code provided by Google which does exactly the same. But its too much of code and its redundant to initialize Google Play Services again if to be done manually.

https://github.com/googlesamples/android-play-location/blob/master/LocationSettings/app/src/main/java/com/google/android/gms/location/sample/locationsettings/MainActivity.java

Thanks in advance.

Resove dependency

I was enjoying this awesome library till today I get this error on all my apps:
Error:A problem occurred configuring project ':???'.

Could not resolve all dependencies for configuration ':???:_debugCompile'.
Could not find any version that matches com.google.android.gms:play-services:5.0.+.
Required by:
geodiscovery_android:???:unspecified > io.nlopez.smartlocation:library:2.0.7

Location onLocationUpdated not firing

When I have 2 location listeners (onLocationUpdated method). One on the application and one on the activity. One of the onLocationUpdated method is not firing. Any idea on how to fix this issue?

SmartLocation.with(getActivity()).location().start(this); (called in a the activity) -- This one is firing the onLocationUpdated method.

SmartLocation.with(getApplicationContext()).location().start(this); (called in application class) - This one is not called at all.

Criteria accuracy used incorrectly

I am getting the following error:

Caused by: java.lang.IllegalArgumentException: accuracy=3
            at android.location.Criteria.setAccuracy(Criteria.java:223)
            at io.nlopez.smartlocation.location.providers.LocationManagerProvider.getProvider(LocationManagerProvider.java:82)
            at io.nlopez.smartlocation.location.providers.LocationManagerProvider.start(LocationManagerProvider.java:45)
            at io.nlopez.smartlocation.SmartLocation$LocationControl.start(SmartLocation.java:130)

Suggested solution: http://stackoverflow.com/a/16439378/2444099

No location available callback

Hello,
would it be please possible to add callback when no location is available?
I know about #37 but solution there is only for when play services are not available. That solution does not handle when GPS is disabled by user on device.

Thank you :)

first time getLastKnownLocation is null

Hello,

very good work!
In the first time you use this (in emulator) the result of getLastKnownLocation is always null.
Emulator have google play service, location service is active and set with "geo fix".

Very thanks
Sam

Error:Attribute "theme" has already been defined

Hi there,

I am getting this error after adding

compile 'io.nlopez.smartlocation:library:2.0.7'

into dependencies

Error:Attribute "theme" has already been defined
Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Applications/adt-bundle-mac-x86_64-20140321/sdk/build-tools/21.1.2/aapt package -f --no-crunch -I /Applications/adt-bundle-mac-x86_64-20140321/sdk/platforms/android-21/android.jar -M /Users/markthien/android/sponseer/app/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /Users/markthien/android/sponseer/app/build/intermediates/res/debug -A /Users/markthien/android/sponseer/app/build/intermediates/assets/debug -m -J /Users/markthien/android/sponseer/app/build/generated/source/r/debug -F /Users/markthien/android/sponseer/app/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package sponseer.com.sponseer -0 apk --output-text-symbols /Users/markthien/android/sponseer/app/build/intermediates/symbols/debug
Error Code:
1
Output:
/Users/markthien/android/sponseer/app/build/intermediates/res/debug/values/values.xml:118: error: Attribute "theme" has already been defined

I know there is a conflict between google play service and appcompat. There are a few solution in SO but none of them can solve this issue. Please kindly let me know any workaround. Thanks !

regards,
Mark Thien

No interval

This is awesome library and works fine.
Doubt : Is there any way to set LocationUpdate interval ?
onLocationUpdated getting called frequently but I would like to call it on every minutes, Is there any way to achieve this ?

Thanks

Location request sometimes doesn't ever return

I'm having an issue in that quite often the library just won't return a location. There are no logs which I can provide and there seems to be no reason why I'm seeing this behaviour. I've tested across multiple devices and maybe one in every 4 or 5 requests wil just never return.

Any ideas?

Code below:

private void getLocation() {
    lastRequestTime = System.currentTimeMillis();
    Log.d(LOGTAG, "LocationHelper - getLocation - START");

    SmartLocation.with(context)
            .location()
            .oneFix()
            .start(new OnLocationUpdatedListener() {
                @Override
                public void onLocationUpdated(Location location) {
                    if (location == null) {
                        Log.d(LOGTAG, "LocationHelper - onLocationUpdated - NO LOCATION!");
                        return;
                    }
                    Log.d(LOGTAG, "LocationHelper - onLocationUpdated - Time to get location: " + ((System.currentTimeMillis() - lastRequestTime)/1000));
                    handleLocationUpdate(location);
                }
            });
}

Callback no location available

I think it's really important to know if we could get the location or not. Thus would be good to have a callback for it. Also would be good to know if it was the provider problem, so you can switch to a different provider.

java.lang.IllegalArgumentException: provider doesn't exist: network

Got this exception, when running in Genymotion emulator.

E/AndroidRuntime( 2556): java.lang.IllegalArgumentException: provider doesn't exist: network
E/AndroidRuntime( 2556):    at android.os.Parcel.readException(Parcel.java:1469)
E/AndroidRuntime( 2556):    at android.os.Parcel.readException(Parcel.java:1419)
E/AndroidRuntime( 2556):    at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:540)
E/AndroidRuntime( 2556):    at android.location.LocationManager.requestLocationUpdates(LocationManager.java:860)
E/AndroidRuntime( 2556):    at android.location.LocationManager.requestLocationUpdates(LocationManager.java:454)
E/AndroidRuntime( 2556):    at io.nlopez.smartlocation.SmartLocationService.startOldSchoolLocation(SmartLocationService.java:151)
E/AndroidRuntime( 2556):    at io.nlopez.smartlocation.SmartLocationService.startLocation(SmartLocationService.java:122)
E/AndroidRuntime( 2556):    at io.nlopez.smartlocation.SmartLocation.createServiceConnection(SmartLocation.java:219)
E/AndroidRuntime( 2556):    at io.nlopez.smartlocation.SmartLocation.access$100(SmartLocation.java:21)
E/AndroidRuntime( 2556):    at io.nlopez.smartlocation.SmartLocation$1.onServiceConnected(SmartLocation.java:198)
E/AndroidRuntime( 2556):    at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1110)
E/AndroidRuntime( 2556):    at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1127)
E/AndroidRuntime( 2556):    at android.os.Handler.handleCallback(Handler.java:733)
E/AndroidRuntime( 2556):    at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 2556):    at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 2556):    at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime( 2556):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2556):    at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 2556):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime( 2556):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime( 2556):    at dalvik.system.NativeStart.main(Native Method)

Error

Hi, Im getting alot of errors with eclipse when im trying to use the library ... I guess i didnt installed the library in my project .. is ther any tutorial/Readme file on how to install your library to use it ? Thanks.

MemoryLeak by broadcastReceiver

Hi, i tried your library, it is very convenient.
But in Strict mode, i got this message in LogCat:

android.app.IntentReceiverLeaked: Service io.nlopez.smartlocation.SmartLocationService has leaked IntentReceiver io.nlopez.smartlocation.SmartLocationService$2@41e3bef8 that was originally registered here. Are you missing a call to unregisterReceiver()?

I think you should correct your code in SmartLocationService.java:

private void continueStartLocation() {
        if (smartLocationOptions.isDebugging()) {
            Log.v(TAG, "fused - continueStartLocation");
        }
        if (locationClient.isConnected()) {
            locationClient.requestLocationUpdates(locationRequest, this);
        } else {
            if (smartLocationOptions.isActivityRecognizer()) {
        IntentFilter intentFilterActivityUpdates = new IntentFilter(ActivityRecognitionConstants.ACTIVITY_CHANGED_INTENT);
        registerReceiver(activityUpdatesReceiver, intentFilterActivityUpdates);

}
}
    }

What do you think?

Location updates only once, even with .continuous()

Just like the title says, this is the code

SmartLocation.with(this).location() .continuous() .start(new OnLocationUpdatedListener() { @Override public void onLocationUpdated(Location location) { //something } });

I'll get the location only once and then it stops

Disconnect notification

Is there a way to get notified once the library gets disconnected from the activity service?

Thanks.

sometimes java.lang.IllegalStateException: GoogleApiClient is not connected yet.

You have a way to fix it ? my application, always when the first time start is crashing!

This is terrible

java.lang.IllegalStateException: GoogleApiClient is not connected yet.
at com.google.android.gms.internal.jx.a(Unknown Source)
at com.google.android.gms.common.api.c.b(Unknown Source)
at com.google.android.gms.internal.nf.requestLocationUpdates(Unknown Source)
at io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesProvider.startUpdating(LocationGooglePlayServicesProvider.java:96)
at io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesProvider.onConnected(LocationGooglePlayServicesProvider.java:128)
at com.google.android.gms.internal.jm.f(Unknown Source)
at com.google.android.gms.common.api.c.gJ(Unknown Source)
at com.google.android.gms.common.api.c.d(Unknown Source)
at com.google.android.gms.common.api.c$2.onConnected(Unknown Source)
at com.google.android.gms.internal.jm.f(Unknown Source)
at com.google.android.gms.internal.jm.dU(Unknown Source)
at com.google.android.gms.internal.jl$h.b(Unknown Source)
at com.google.android.gms.internal.jl$h.g(Unknown Source)
at com.google.android.gms.internal.jl$b.hy(Unknown Source)
at com.google.android.gms.internal.jl$a.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)

Add a new method to provide a "trying"

Will be good to add a method to provide a trying on oneFix() method.
Look like:

int maxTimeRequest = 5000;

SmartLocation.with(this)
      .location()
      .oneFix(5, maxTimeRequest) //Will try to get location 5 times in miliseconds.
      .statusCallback(new OnStatusCallbackListener(){}
      .start(new OnLocationUpdatedListener(){});  

problem with LocationManagerProvider

Hi

I'm trying to use LocationManagerProvider (as fallback when user doen't have network location active)

My issue is that when I use SmartLocation never get Location (but with common GPS code works fine).

I guess I'm doing something wrong, maybe my mistake can help others

With SmartLocation

provider = new LocationManagerProvider();
params = new LocationParams.Builder().setAccuracy(LocationAccuracy.HIGH).build();

SmartLocation.with(getActivity()).location()
        .provider(provider)
        .config(params)
        .oneFix()
        .start(new OnLocationUpdatedListener() {
            @Override
            public void onLocationUpdated(Location location) {
                Log.d(TAG, "Response from smartlocation listener");
                if (coordListener != null) {
                    coordListener.onCoordsDetected(location);
                }
            }
        });

Test without SmartLocation

LocationManager locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);

LocationListener locationListener = new LocationListener()
{

    @Override
    public void onStatusChanged(String provider, int status, Bundle extras) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onProviderEnabled(String provider) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onProviderDisabled(String provider) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onLocationChanged(Location location) {
        if (coordListener != null) {
            coordListener.onCoordsDetected(location);
        }
        Log.d(TAG, "Without lib");
    }
};

locationManager.requestSingleUpdate(LocationManager.GPS_PROVIDER, locationListener, null);

GoogleApiClient is not connected yet, same problem on #26, #27.

After following this scenario, you may show same error on your phone.

  1. Launch smart-location-lib sample app.
  2. Click "Start Location!" button.
  3. Click home button on your phone.
  4. And relaunch the sample app.

client.isConnected() returned false on startUpdating method in LocationGooglePlayServicesProvider.java. And then, GoogleApiClient returned this exception; FATAL EXCEPTION: main java.lang.IllegalStateException: GoogleApiClient is not connected yet.

I dont' understand why It happened.

02-04 14:11:18.381 8232-8232/com.andando.video E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalStateException: GoogleApiClient is not connected yet.
at com.google.android.gms.internal.jx.a(Unknown Source)
at com.google.android.gms.common.api.c.b(Unknown Source)
at com.google.android.gms.internal.nb.requestActivityUpdates(Unknown Source)
at io.nlopez.smartlocation.activity.providers.ActivityGooglePlayServicesProvider.startUpdating(ActivityGooglePlayServicesProvider.java:85)
at io.nlopez.smartlocation.activity.providers.ActivityGooglePlayServicesProvider.onConnected(ActivityGooglePlayServicesProvider.java:115)
at com.google.android.gms.internal.jm.f(Unknown Source)
at com.google.android.gms.common.api.c.gJ(Unknown Source)
at com.google.android.gms.common.api.c.d(Unknown Source)
at com.google.android.gms.common.api.c$2.onConnected(Unknown Source)
at com.google.android.gms.internal.jm.f(Unknown Source)
at com.google.android.gms.internal.jm.dU(Unknown Source)
at com.google.android.gms.internal.jl$h.b(Unknown Source)
at com.google.android.gms.internal.jl$h.g(Unknown Source)
at com.google.android.gms.internal.jl$b.hy(Unknown Source)
at com.google.android.gms.internal.jl$a.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
at dalvik.system.NativeStart.main(Native Method)

Gradle Issue

Despite adding the "transitive" clause in Gradle, I am still getting the below error. Kindly help.

or:(44, 13) Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#com.google.android.gms.version@value value=(@integer/google_play_services_version) from AndroidManifest.xml:44:13
    is also present at io.nlopez.smartlocation:library:3.0.5:28:13 value=(6587000)
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:42:9 to override


    Error:(46, 13) Attribute meta-data#com.google.android.gms.version@value value=(@integer/google_play_services_version) from AndroidManifest.xml:46:13

Add a location fallback with LocationManager

Due some bugs in the framework we should support a fallback mechanism so if in a configurable (default 5) seconds value, we use the old way instead of the google play services fused location provider.

more than one library with package name 'com.google.android.gms'

adding the library to my project gives the error as above.

Error:Execution failed for task ':app:processDebugResources'.
> Error: more than one library with package name 'com.google.android.gms'
  You can temporarily disable this error with android.enforceUniquePackageName=false
  However, this is temporary and will be enforced in 1.0

onGeofenceTransition not firing

i keep getting the message "geofencing event" on my log but it doesn't actually call the onGeofenceTransition event.

Any reason on why onGeofenceTransition would not fire?

NoClassDefFoundError io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesProvider

I already have Play services as a dependency in my project. So I add
compile ('io.nlopez.smartlocation:library:3.0.3'){
transitive = false
}

to my dependencies and when the application tries to use the library, it crashes with following error

java.lang.NoClassDefFoundError: io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesProvider
at io.nlopez.smartlocation.SmartLocation$LocationControl.(SmartLocation.java:89)
at io.nlopez.smartlocation.SmartLocation.location(SmartLocation.java:43)
at <my.package.names>

LocationGooglePlayServicesProvider doesn't reconnect the GoogleApiClient on start()

Hi,

I seem to have encountered a problem with the LocationGooglePlayServicesProvider. After stop() has been called, a new start() never actually starts to retrieve a new location.

The reason for this is that stop() disconnects the GoogleApiClient. In start(), when the client is disconnected, only the shouldStart flag is set, probably assuming the the connection-call from init() is still running. However, connect() is never called again, and thus the onConnected()-callback, which would start the location update, is never called either.

Is this intentional? Otherwise it would be great if you could provide a fix.

On location updated never called

new SmartLocation.OnLocationUpdatedListener() {
@OverRide
public void onLocationUpdated(Location location, DetectedActivity detectedActivity) {
// In here you have the location and the activity. Do whatever you want with them!
}
});

The code doesn't enter the following method hence returning the location null always. Any fixes?

Location update not working in emulator

Could it be that is not working?

I'm using genymotion, and with the gp service provider it only updates the location if I open google maps, and with the normal location provider it never gets triggered.

FATAL EXCEPTION with Google Play Services 6.5.87

FATAL EXCEPTION http://stackoverflow.com/questions/27372638/android-play-services-6-5-locationclient-is-missing

12-11 09:10:36.758  26218-26218/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: xxx, PID: 26218
    java.lang.NoClassDefFoundError: com.google.android.gms.location.LocationClient
            at io.nlopez.smartlocation.SmartLocationService.initLocation(SmartLocationService.java:90)
            at io.nlopez.smartlocation.SmartLocationService.onCreate(SmartLocationService.java:75)
            at android.app.ActivityThread.handleCreateService(ActivityThread.java:2558)
            at android.app.ActivityThread.access$1800(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5001)
            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:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)

java.lang.NullPointerException

Hi, if we call SmartLocation.with(context).location().start(null) with null listener, we will get NPE:

java.lang.NullPointerException
            at io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesProvider.onLocationChanged(LocationGooglePlayServicesProvider.java:147)
            at com.google.android.gms.internal.nj$a.handleMessage(Unknown Source)
            at android.os.Handler.dispatchMessage(Handler.java:107)
            at android.os.Looper.loop(Looper.java:194)
            at android.app.ActivityThread.main(ActivityThread.java:5371)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
            at dalvik.system.NativeStart.main(Native Method)

java.lang.IllegalStateException: GoogleApiClient is not connected yet.

Hi, when i call method SmartLocation.with(getActivity()).location().getLastLocation() in onStart() i got this exception:

java.lang.IllegalStateException: GoogleApiClient is not connected yet.
            at com.google.android.gms.internal.jx.a(Unknown Source)
            at com.google.android.gms.common.api.c.b(Unknown Source)
            at com.google.android.gms.internal.nf.requestLocationUpdates(Unknown Source)
            at io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesProvider.startUpdating(LocationGooglePlayServicesProvider.java:96)
            at io.nlopez.smartlocation.location.providers.LocationGooglePlayServicesProvider.onConnected(LocationGooglePlayServicesProvider.java:128)
            at com.google.android.gms.internal.jm.f(Unknown Source)
            at com.google.android.gms.common.api.c.gJ(Unknown Source)
            at com.google.android.gms.common.api.c.d(Unknown Source)
            at com.google.android.gms.common.api.c$2.onConnected(Unknown Source)
            at com.google.android.gms.internal.jm.f(Unknown Source)
            at com.google.android.gms.internal.jm.dU(Unknown Source)
            at com.google.android.gms.internal.jl$h.b(Unknown Source)
            at com.google.android.gms.internal.jl$h.g(Unknown Source)
            at com.google.android.gms.internal.jl$b.hy(Unknown Source)
            at com.google.android.gms.internal.jl$a.handleMessage(Unknown Source)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5103)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
            at dalvik.system.NativeStart.main(Native Method)

Wrong code snippet in README.md

On Customizing to your needs, it is written:

options.setOnLocationUpdatedNewStrategy(new SmartLocationOptions.OnLocationUpdated() {

While sources doesn't have setOnLocationUpdatedNewStrategy() as evidently on sample's MainActivity:

SmartLocationOptions options = new SmartLocationOptions();
options.setPackageName(PACKAGE_NAME)
    .setDefaultUpdateStrategy(UpdateStrategy.BEST_EFFORT)
    .setOnActivityRecognizerUpdatedNewStrategy(new SmartLocationOptions.OnActivityRecognizerUpdated() {
    @Override
    public UpdateStrategy getUpdateStrategyForActivity(DetectedActivity detectedActivity) {
        switch (detectedActivity.getType()) {
            case DetectedActivity.IN_VEHICLE:
            case DetectedActivity.ON_BICYCLE:
                return UpdateStrategy.NAVIGATION;
            default:
                return UpdateStrategy.BEST_EFFORT;
        }
    }
});

Not working in Genymotion

Smartlocation library not working in Genymotion emulator. After sets GPS coords in emulator, smart-location-lib doesn't recognize location. Google Maps works in Genymotion correctly. Is there change to fix that? Thanks!

Could not resolve the library

Hi,
am using gradle and it cannot resolve the library. In build.gradle file I have:
repositories {
mavenCentral()

maven {
    url 'http://maven-repo.mobivery.com.s3.amazonaws.com/release'
}

}

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile group: 'com.mobivery.greent.smartlocation', name: 'library', version: '1.0.1'
}

and the erro I got is:

Gradle 'kegs-mobile' project refresh failed: Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.8-bin.zip'. A problem occurred configuring root project 'kegs-mobile'. A problem occurred configuring root project 'kegs-mobile'. Failed to notify project evaluation listener. Could not resolve all dependencies for configuration ':_DebugCompile'. Could not resolve com.mobivery.greent.smartlocation:library:1.0.1. Required by: :kegs-mobile:unspecified Could not resolve com.mobivery.greent.smartlocation:library:1.0.1. Could not parse POM http://maven-repo.mobivery.com.s3.amazonaws.com/release/com/mobivery/greent/smartlocation/library/1.0.1/library-1.0.1.pom Could not resolve com.mobivery.greent.smartlocation:parent:1.0.1. Could not resolve com.mobivery.greent.smartlocation:parent:1.0.1. Could not parse POM http://maven-repo.mobivery.com.s3.amazonaws.com/release/com/mobivery/greent/smartlocation/parent/1.0.1/parent-1.0.1.pom Could not HEAD 'http://maven-repo.mobivery.com.s3.amazonaws.com/release/com/mobivery/greent/smartlocation/parent/1.0.1/parent-1.0.1.jar'. Received status code 403 from server: Forbidden

Thanks.

Leak

I am unregistering the receiver in code usign stop and cleanup.

E/ActivityThread﹕ Service io.nlopez.smartlocation.SmartLocationService has leaked IntentReceiver io.nlopez.smartlocation.SmartLocationService$2@2bcb9b72 that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Service io.nlopez.smartlocation.SmartLocationService has leaked IntentReceiver io.nlopez.smartlocation.SmartLocationService$2@2bcb9b72 that was originally registered here. Are you missing a call to unregisterReceiver()?
at android.app.LoadedApk$ReceiverDispatcher.(LoadedApk.java:898)
at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:699)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1637)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1617)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1611)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:488)
at io.nlopez.smartlocation.SmartLocationService.j_(SmartLocationService.java:325)
at amg.a(Unknown Source)
at amk.a(Unknown Source)
at amf.a(Unknown Source)
at ame.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Crash: provider doesn't exist: network

I tried to test library v. 2.0.8 with Android emulator 4.4.2 without Google API. If additional info is required please ask.

01-01 13:16:04.431 2187-2205/com.trukom.livegps E/SmartLocationOptions﹕ GMS not found or there were errors connecting. Disabling fused providers and activity recognizers to avoid app-breaking exceptions
01-01 13:16:04.431 2187-2205/com.trukom.livegps V/SmartLocationService﹕ old - Trying with network
01-01 13:16:35.742 2187-2205/com.trukom.livegps E/AndroidRuntime﹕ FATAL EXCEPTION: ServiceStartArguments
Process: com.trukom.livegps, PID: 2187
java.lang.IllegalArgumentException: provider doesn't exist: network
at android.os.Parcel.readException(Parcel.java:1469)
at android.os.Parcel.readException(Parcel.java:1419)
at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:540)
at android.location.LocationManager.requestLocationUpdates(LocationManager.java:860)
at android.location.LocationManager.requestLocationUpdates(LocationManager.java:454)
at io.nlopez.smartlocation.SmartLocationService.setLocationRequestValues(SmartLocationService.java:218)
at io.nlopez.smartlocation.SmartLocationService.setOptions(SmartLocationService.java:186)
at io.nlopez.smartlocation.SmartLocation.setOptions(SmartLocation.java:165)
at io.nlopez.smartlocation.SmartLocation.start(SmartLocation.java:109)
at io.nlopez.smartlocation.SmartLocation.start(SmartLocation.java:97)
at ...

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.