Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Adding features does not necessarily increase functionality -- it just makes the manuals thicker.


computers / comp.mobile.android / gps background update

SubjectAuthor
o gps background updateJakub

1
gps background update

<uo0iv8$5t8r$1@news.icm.edu.pl>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=49064&group=comp.mobile.android#49064

  copy link   Newsgroups: comp.mobile.android
Path: i2pn2.org!i2pn.org!news.chmurka.net!news.icm.edu.pl!.POSTED.public-gprs409978.centertel.pl!not-for-mail
From: jak...@interia.pl (Jakub)
Newsgroups: comp.mobile.android
Subject: gps background update
Date: Sun, 14 Jan 2024 13:10:43 +0100
Organization: ICM, Uniwersytet Warszawski
Message-ID: <uo0iv8$5t8r$1@news.icm.edu.pl>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 14 Jan 2024 12:10:17 -0000 (UTC)
Injection-Info: news.icm.edu.pl; posting-host="public-gprs409978.centertel.pl:37.47.232.187";
logging-data="193819"; mail-complaints-to="usenet@news.icm.edu.pl"
User-Agent: Mozilla Thunderbird
Content-Language: pl
 by: Jakub - Sun, 14 Jan 2024 12:10 UTC

I have this fun to get gps location

fun getLocation11(context: Context) {

val fusedLocationClient =
LocationServices.getFusedLocationProviderClient(context)

if ( ActivityCompat.checkSelfPermission(context,
Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(context,
Manifest.permission.ACCESS_COARSE_LOCATION) !=
PackageManager.PERMISSION_GRANTED ) {

return
}

fusedLocationClient.getCurrentLocation(PRIORITY_HIGH_ACCURACY,
object : CancellationToken() {
override fun onCanceledRequested(p0:
OnTokenCanceledListener): CancellationToken
= CancellationTokenSource().token

override fun isCancellationRequested(): Boolean = false
}).addOnSuccessListener {location: Location? ->
if ( location != null ) {
getAddressFromPosittion(context, location.latitude,
location.longitude)
}
}

}

and this function to start

private fun startService() : Boolean {
if ( !ACCESS_FINE_LOCATION_permision ) {
showAlert03(aThis, "permision", "gps not granted",
fontTextSize)
return false
}

if ( !gpsPositionActual02.isGPS(aThis) ) {
showAlert03(aThis, "GPS", "gps is disabled", fontTextSize)
return false
}

myTimer = Timer()
val delay = 0 // delay for 30 sec.

val period = 10000 // repeat every 10 sec.
//val period = 60000 // repeat every 60 sec.

doThis = object : TimerTask() {
override fun run() {
readGPSPosittion()
}
}

myTimer.scheduleAtFixedRate(doThis, delay.toLong(), period.toLong())

return true
}

and android manifest

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE" />

<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

fun work fine but when i minimize app this function dont show actual
possition

how to fix this?

how to get actual gps locattion when app is minimize?

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor