Skip to content

Refactored location request to use LocationRequest.Builder for better… #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mad-location-manager
Submodule mad-location-manager added at 903129
95 changes: 8 additions & 87 deletions madlocationmanager/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
plugins {
id 'com.android.library'
id 'maven-publish'
id "com.jfrog.bintray" version "1.8.5"

}

group='com.github.maddevsio'

ext {
// if CI does not set RELEASE_VERSION use hardcoded one
releaseVersion = System.getenv('RELEASE_VERSION') ?: '0.1.14'
}

android {
Expand Down Expand Up @@ -45,98 +35,29 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

task sourceJar(type: Jar) {
tasks.register('sourceJar', Jar) {
archiveClassifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

tasks.withType(Javadoc) {
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
}

task androidJavadocs(type: Javadoc, dependsOn: build) {
tasks.register('androidJavadocs', Javadoc) {
dependsOn build
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
android.libraryVariants.all { variant ->
android.libraryVariants.configureEach { variant ->
if (variant.name == 'release') {
owner.classpath += variant.javaCompileProvider.get().classpath
}
}
exclude '**/R.html', '**/R.*.html', '**/index.html'
}

task javadocJar(type: Jar, dependsOn: androidJavadocs) {
tasks.register('javadocJar', Jar) {
dependsOn androidJavadocs
archiveClassifier.set('javadoc')
from androidJavadocs.destinationDir
}

project.afterEvaluate {
publishing {
publications {
mavenPublication(MavenPublication) {
groupId = 'com.maddevsio.mad-location-manager'
artifactId = 'mad-location-manager'
version = releaseVersion

from components.release
artifact sourceJar
artifact javadocJar

pom {
packaging 'aar'
name = 'Mad Location Manager'
description = 'This is library for GPS and Accelerometer data "fusion" with Kalman filter'
url = 'https://github.com/maddevsio/mad-location-manager'
licenses {
license {
name = 'MIT'
url = 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'Lezh1k'
name = 'Oleg Katkov'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/maddevsio/mad-location-manager.git'
developerConnection = 'scm:git:ssh://github.com/maddevsio/mad-location-manager.git'
url = 'https://github.com/maddevsio/mad-location-manager'
}
}
}
}
}
}
bintray {
dryRun = false
publish = true
override = true
user = System.getenv('BINTRAY_USER') ?: (project.hasProperty('bintrayUser') ? project.property('bintrayUser') : '')
key = System.getenv('BINTRAY_KEY') ?: (project.hasProperty('bintrayKey') ? project.property('bintrayKey') : '')
publications = ['mavenPublication']

pkg {
repo = 'maven'
name = 'mad-location-manager'
userOrg = 'Lezh1k'
description = 'This is library for GPS and Accelerometer data "fusion" with Kalman filter'
publications = ['mavenPublication']
licenses = ['MIT']
vcsUrl = 'https://github.com/maddevsio/mad-location-manager.git'
websiteUrl = 'https://github.com/maddevsio/mad-location-manager.git'
issueTrackerUrl = 'https://github.com/maddevsio/mad-location-manager/issues'
githubRepo = 'maddevsio/mad-location-manager'
githubReleaseNotesFile = 'README.md'
version {
name = releaseVersion
desc = 'Mad Location Manager v' + releaseVersion
released = new Date()
vcsTag = releaseVersion
}
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,17 @@ public FusedLocationProvider(Context context,LocationProviderCallback m_location
anyOf = {"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"}
)
public void startLocationUpdates(Settings m_settings, HandlerThread thread) {
m_locationRequest = LocationRequest.create();
m_locationRequest.setInterval(m_settings.gpsMinTime);
m_locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
m_locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY)
.setIntervalMillis(m_settings)
.setMinUpdateIntervalMillis(2000)
.setMinUpdateDistanceMeters(20)
.build();
// m_locationRequest = LocationRequest.create();
// m_locationRequest.setInterval(m_settings.gpsMinTime);
// m_locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
m_fusedLocationProviderClient.requestLocationUpdates(m_locationRequest,
locationCallback,
thread.getLooper());
locationCallback,
thread.getLooper());
}


Expand Down