mindorksopensource / fused-location-api-example Goto Github PK
View Code? Open in Web Editor NEWAn example project to demonstrate how to use Fused Location API to fetch the current location in Android
An example project to demonstrate how to use Fused Location API to fetch the current location in Android
Hello,
I'm trying to use your code, however I'm getting issues with some versions in the dependencies, can someone help me out here?
e: C:/Users/user/.gradle/caches/transforms-2/files-2.1/7980168ed644bcd1d1c470386ac7a470/jetified-kotlin-stdlib-1.5.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.16. e: C:/Users/user/.gradle/caches/transforms-2/files-2.1/94de443224b407a2011360fdde6bd78b/jetified-core-ktx-1.6.0-api.jar!/META-INF/core-ktx_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.16. e: C:/Users/user/.gradle/caches/transforms-2/files-2.1/c59da2ac229afacb8c7416996b012d0d/jetified-kotlin-stdlib-common-1.5.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.16.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.github.kittinunf.fuel:fuel:2.3.1' //Core package
implementation 'com.github.kittinunf.fuel:fuel-android:2.2.1' //Android
implementation 'com.github.kittinunf.fuel:fuel-gson:2.2.1' //Fuel Gson
implementation 'com.google.code.gson:gson:2.8.6' //Gson
implementation 'com.github.kittinunf.fuel:fuel:2.3.1'
}
In the foreground, the app works beautifully, but as soon as I make the app go to the background, the location updates don't get triggered at all. Have added ACCESS_BACKGROUND_LOCATION permission in Manifest and I'm requesting ACCESS_BACKGROUND_LOCATION permission on App Launch.
Android Manifest
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
PermissionUtils
fun requestAccessFineLocationPermission(activity: AppCompatActivity, requestId: Int) { ActivityCompat.requestPermissions( activity, arrayOf( Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_BACKGROUND_LOCATION ), requestId ) }
Am i missing anything here ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.