How to import com.android.location.provider?

2.2k Views Asked by At

How I can import com.android.location.provider for creating custom unbundled location provider? I use android studio and I import .jar file but it doesn't work . in java code I wrote :

import com.android.location.provider.LocationProviderBase;

but It makes error and compiler can't reference to the library .

2

There are 2 best solutions below

0
ofskyMohsen On BEST ANSWER

Finally I found the solution. Library com.android.location.provider.LocationProviderBase is not in public android API which is implemented in android.jar and can not be used easily.For referencing to this library you should use reflection in java and linking process occurs at runtime.

OR

You should get source of this package and manually add it to your project.

1
Sonam On

You need to set up Google Play services.

Follow following link to set up the google play service: https://developers.google.com/android/guides/setup

Add following lines to you gradle file:

dependencies {
    compile 'com.google.android.gms:play-services:9.2.0'
    compile 'com.google.android.gms:play-services-location:9.2.0'
    }

You can use following links for further information: https://developer.android.com/training/location/index.html http://www.vogella.com/tutorials/AndroidLocationAPI/article.html