Получение текущего местоположения в Android с помощью API Google Map - PullRequest
0 голосов
/ 09 ноября 2018

Я работаю над Google Maps API, чтобы узнать мое текущее местоположение в приложении. Я работаю в Котлине и следую учебному пособию. Я сделал весь бэкэнд и интерфейсный код, но он не работает, и я не понимаю, что не так. Ниже приведен мой основной код активности.

import android.Manifest
import android.content.pm.PackageManager
import android.location.Location
import android.os.Build
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.os.Looper
import android.support.v4.app.ActivityCompat
import android.support.v4.content.ContextCompat
import android.widget.Toast
import com.google.android.gms.location.*
import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.OnMapReadyCallback
import com.google.android.gms.maps.SupportMapFragment
import com.google.android.gms.maps.model.BitmapDescriptorFactory
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.Marker
import com.google.android.gms.maps.model.MarkerOptions

class MapsActivity : AppCompatActivity(), OnMapReadyCallback {

    private lateinit var mMap: GoogleMap

    private var latitude: Double = 0.toDouble()
    private var longitude: Double = 0.toDouble()
    private lateinit var mLastLocation: Location
    private var mMarker : Marker? = null

    //Location
    private lateinit var fusedLocationProviderClient: FusedLocationProviderClient
    private lateinit var locationRequest: LocationRequest
    private lateinit var locationCallback: LocationCallback

    var permissions : Array<String> = arrayOf(Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_COARSE_LOCATION)

    companion object {
        private const val PERMISSION_REQUEST: Int = 1000
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_maps)
        // Obtain the SupportMapFragment and get notified when the map is ready to be used.
        val mapFragment = supportFragmentManager
            .findFragmentById(R.id.map) as SupportMapFragment
        mapFragment.getMapAsync(this)

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            if (checkLocationPermission()) {
                buildLocationRequest()
                buildLocationCallback()

                fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this)
                fusedLocationProviderClient.requestLocationUpdates(
                    locationRequest,
                    locationCallback,
                    Looper.myLooper()

                )
            } else {
                buildLocationRequest()
                buildLocationCallback()

                fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this)
                fusedLocationProviderClient.requestLocationUpdates(
                    locationRequest,
                    locationCallback,
                    Looper.myLooper()
                )
            }
    }


}

    private fun buildLocationCallback() {
        locationCallback = object : LocationCallback() {
            override fun onLocationResult(p0: LocationResult?) {
                //Get Last location
                mLastLocation = p0!!.locations.get(p0.locations.size - 1)
                if (mMarker != null) {
                    mMarker!!.remove()
                }
                latitude = mLastLocation.latitude
                longitude = mLastLocation.longitude

                val latlng = LatLng(latitude,longitude)
                val markerOptions = MarkerOptions()
                    .position(latlng)
                    .title("My Position")
                    .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN))
                mMarker = mMap.addMarker(markerOptions)
                mMap.moveCamera(CameraUpdateFactory.newLatLng(latlng))
                mMap.animateCamera(CameraUpdateFactory.zoomTo(11f))
            }
        }
    }

    private fun buildLocationRequest() {
        locationRequest = LocationRequest()
        locationRequest.priority = LocationRequest.PRIORITY_HIGH_ACCURACY
        locationRequest.interval = 5000
        locationRequest.fastestInterval = 3000
        locationRequest.smallestDisplacement = 10f

    }
    private fun checkLocationPermission(): Boolean {
        if (ContextCompat.checkSelfPermission(
                this,
                Manifest.permission.ACCESS_FINE_LOCATION
            ) != PackageManager.PERMISSION_GRANTED
        ) {
            if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION))
                ActivityCompat.requestPermissions(
                    this,
                    permissions,
                    PERMISSION_REQUEST
                )
            else
                ActivityCompat.requestPermissions(
                    this,
                    permissions,
                    PERMISSION_REQUEST
                )
            return false
        } else
            return true
    }

    override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
        when (requestCode) {
            PERMISSION_REQUEST -> {
                if ((grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED)) {
                    // Toast.makeText(this, "Location is ON", Toast.LENGTH_SHORT).show()
                    if (ContextCompat.checkSelfPermission(
                            this,
                            Manifest.permission.ACCESS_FINE_LOCATION
                        ) == PackageManager.PERMISSION_GRANTED
                    )
                        if (checkLocationPermission()) {
                            buildLocationRequest()
                            buildLocationCallback()

                            fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this)
                            fusedLocationProviderClient.requestLocationUpdates(
                                locationRequest,
                                locationCallback,
                                Looper.myLooper()
                            )
                            mMap.isMyLocationEnabled = true
                        }
                } else {
                    Toast.makeText(this, "Permission is denied", Toast.LENGTH_SHORT).show()
                }
            }
        }
    }
    override fun onStop() {
        fusedLocationProviderClient.removeLocationUpdates(locationCallback)
        super.onStop() }
    override fun onMapReady(googleMap: GoogleMap) {
        mMap = googleMap

        // Add a marker in Sydney and move the camera
     /*   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            if (ContextCompat.checkSelfPermission(
                    this,
                    Manifest.permission.ACCESS_FINE_LOCATION
                ) == PackageManager.PERMISSION_GRANTED
            )
                mMap.isMyLocationEnabled = true
        } else {
            mMap.isMyLocationEnabled = true
            mMap.uiSettings.isZoomControlsEnabled = true
        }*/
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
        if (mMap != null) {
            val permission = ContextCompat.checkSelfPermission(
                this,
                Manifest.permission.ACCESS_FINE_LOCATION
            )

            if (permission == PackageManager.PERMISSION_GRANTED) {
                mMap?.isMyLocationEnabled = true
            }
        }else {
                requestPermissions(
                    permissions,
                    PERMISSION_REQUEST)
            }
        }

    }


}

Вот мой logcat, пожалуйста, помогите мне, что случилось или чего не хватает.

2018-11-09 14:57:22.735 26954-26954/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2018-11-09 14:57:23.068 23972-23972/? E/adbd: recv: OPEN 0000006d 00000000 0014:73 68 65 6C 6C 3A 6C 6F 67 63 61 74 20 2D 2D 68 65 6C 70 00 
2018-11-09 14:57:23.547 23972-23972/? E/adbd: recv: OPEN 0000006e 00000000 001e:73 68 65 6C 6C 3A 6C 6F 67 63 61 74 20 2D 76 20 6C 6F 6E 67 20 2D 76 20 65 70 6F 63 68 00 
2018-11-09 14:57:26.834 4720-5324/? E/Watchdog: !@Sync 5897 [2018-11-09 14:57:26.834]
2018-11-09 14:57:28.321 5182-5719/? E/ImsAdaptorImpl2: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:28.330 5182-5719/? E/ImsAdaptorImpl2: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:32.696 4427-4812/? E/installd: Failed to free up 1048576000 on /data; final free space 596750336: Success
2018-11-09 14:57:32.750 4427-4812/? E/installd: Failed to free up 1048576000 on /data; final free space 596750336: Success
2018-11-09 14:57:32.883 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:32.891 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:36.375 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:36.382 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:38.770 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:38.777 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:39.663 4467-24946/? E/(FPLOG): DeviceWaitInt poll trigger
2018-11-09 14:57:39.665 4467-24946/? E/(FPLOG): 2.0.36.0 DeviceSetClock 1
2018-11-09 14:57:39.667 4467-24946/? E/(FPLOG): DeviceEnableInt 0 8 10 1
2018-11-09 14:57:39.857 4467-24946/? E/TLC_BAUTH:   *****************************
2018-11-09 14:57:39.857 4467-24946/? E/TLC_BAUTH:   *** ERROR: Trustlet did not send a valid return code : 39
2018-11-09 14:57:39.857 4467-24946/? E/TLC_BAUTH:   *** Detected in Locals/Code/tlc_bioauth.cpp:1291()
2018-11-09 14:57:39.857 4467-24946/? E/TLC_BAUTH:   *****************************
2018-11-09 14:57:39.857 4467-24946/? E/bauth_FPBAuthService: BAuth_Identify_Do Fail BAD_QUALITY or Identify Fail : 39 
2018-11-09 14:57:40.444 4467-24946/? E/(FPLOG): DeviceEnableInt 1 8 10 1
2018-11-09 14:57:40.444 4467-24946/? E/(FPLOG): 2.0.36.0 DeviceSetClock 0
2018-11-09 14:57:40.843 4467-24946/? E/(FPLOG): DeviceWaitInt poll trigger
2018-11-09 14:57:40.843 4467-24946/? E/(FPLOG): 2.0.36.0 DeviceSetClock 1
2018-11-09 14:57:40.843 4467-24946/? E/(FPLOG): DeviceEnableInt 0 8 10 1
2018-11-09 14:57:41.006 4467-24946/? E/(FPLOG): DeviceEnableInt 1 8 10 1
2018-11-09 14:57:41.007 4467-24946/? E/(FPLOG): 2.0.36.0 DeviceSetClock 0
2018-11-09 14:57:41.555 4467-24946/? E/(FPLOG): DeviceWaitInt poll trigger
2018-11-09 14:57:41.555 4467-24946/? E/(FPLOG): 2.0.36.0 DeviceSetClock 1
2018-11-09 14:57:41.555 4467-24946/? E/(FPLOG): DeviceEnableInt 0 8 10 1
2018-11-09 14:57:41.781 5214-5214/? E/KeyguardUpdateMonitor: handleStartedWakingUp start 18
2018-11-09 14:57:41.787 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:41.795 5214-5214/? E/KeyguardUpdateMonitor: handleStartedWakingUp end
2018-11-09 14:57:41.796 5182-5719/? E/ImsAdaptorImpl2: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:41.800 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:41.912 5354-5397/? E/RequestManager_FLP: [FusedLocationApi] Location request 136b4cb PRIORITY_HIGH_ACCURACY interval=5000 from com.malik.testapplication
2018-11-09 14:57:41.912 3051-3054/? E/TZ_CCM_SERVER: *** , ccm_server 739
2018-11-09 14:57:41.912 3051-3054/? E/TZ_CCM_SERVER: *** , ccm_server 759
2018-11-09 14:57:41.981 4720-4738/? E/BatteryExternalStatsWorker: no controller energy info supplied for bluetooth
2018-11-09 14:57:42.035 3051-24319/? E/TZ_CCM_SERVER: *** , ccm_server 801
2018-11-09 14:57:42.035 3051-24319/? E/TZ_CCM_SERVER: *** , ccm_server 818
2018-11-09 14:57:42.065 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:42.072 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:42.083 30596-30628/? E/BtGatt.GattService: [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_STOP, appName: android.uid.bcmgr, scannerId: 4, reportDelayMillis=0
2018-11-09 14:57:42.130 3051-24319/? E/TZ_CCM_SERVER: *** , ccm_server 739
2018-11-09 14:57:42.130 3051-24319/? E/TZ_CCM_SERVER: *** , ccm_server 759
2018-11-09 14:57:42.190 30596-30628/? E/BtGatt.GattService: [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_START, appName: android.uid.bcmgr, scannerId: 4, reportDelayMillis=0
2018-11-09 14:57:42.212 30596-30627/? E/BtGatt.ScanManager: default value of curScanSetting 0 is choosen
2018-11-09 14:57:42.245 3051-3054/? E/TZ_CCM_SERVER: *** , ccm_server 801
2018-11-09 14:57:42.245 3051-3054/? E/TZ_CCM_SERVER: *** , ccm_server 818
2018-11-09 14:57:42.265 5214-5214/? E/KeyguardFingerPrint: updateFingerprintListeningState#mFingerprintRunningState=0 shouldListenForFingerprint=false
2018-11-09 14:57:42.373 4467-24946/? E/(FPLOG): DeviceEnableInt 1 8 10 1
2018-11-09 14:57:42.373 4467-24946/? E/(FPLOG): 2.0.36.0 DeviceSetClock 0
2018-11-09 14:57:42.419 5198-5198/? E/SKBD: bbw getInstance start
2018-11-09 14:57:42.419 5198-5198/? E/SKBD: bbw sendSIPInformation state: 6   isAbstractKeyboardView :  true
2018-11-09 14:57:42.423 5198-27022/? E/SKBD: bbw sending null keyboardInfo as SIP is closed
2018-11-09 14:57:42.481 5214-5214/? E/KeyguardFingerPrint: updateFingerprintListeningState#mFingerprintRunningState=0 shouldListenForFingerprint=false
2018-11-09 14:57:42.539 3051-3054/? E/TZ_CCM_SERVER: *** , ccm_server 739
2018-11-09 14:57:42.539 3051-3054/? E/TZ_CCM_SERVER: *** , ccm_server 759
2018-11-09 14:57:42.557 4720-4720/? E/MotionRecognitionService:   mReceiver.onReceive : ACTION_USER_PRESENT  :: UNLOCK SCREEN
2018-11-09 14:57:42.563 3051-24319/? E/TZ_CCM_SERVER: *** , ccm_server 801
2018-11-09 14:57:42.563 3051-24319/? E/TZ_CCM_SERVER: *** , ccm_server 818
2018-11-09 14:57:42.565 4720-4720/? E/MotionRecognitionService:   mReceiver.onReceive : ACTION_USER_PRESENT  :: UNLOCK SCREEN
2018-11-09 14:57:42.586 3051-24319/? E/TZ_CCM_SERVER: *** , ccm_server 739
2018-11-09 14:57:42.586 3051-24319/? E/TZ_CCM_SERVER: *** , ccm_server 759
2018-11-09 14:57:42.613 3051-3054/? E/TZ_CCM_SERVER: *** , ccm_server 801
2018-11-09 14:57:42.614 3051-3054/? E/TZ_CCM_SERVER: *** , ccm_server 818
2018-11-09 14:57:42.729 4720-5167/? E/LightsService: Light requested not available on this device. 2
2018-11-09 14:57:42.762 4720-5321/? E/WindowManager: win=Window{76e4f5e u0 Bouncer} destroySurfaces: appStopped=true win.mWindowRemovalAllowed=false win.mRemoveOnExit=false win.mViewVisibility=4, caller=com.android.server.wm.WindowManagerService.tryStartExitingAnimation:2851 com.android.server.wm.WindowManagerService.relayoutWindow:2590 com.android.server.wm.Session.relayout:267 android.view.IWindowSession$Stub.onTransact:288 com.android.server.wm.Session.onTransact:191 
2018-11-09 14:57:42.792 5214-5214/? E/KeyguardFingerPrint: updateFingerprintListeningState#mFingerprintRunningState=0 shouldListenForFingerprint=false
2018-11-09 14:57:42.871 4467-24946/? E/(FPLOG): DeviceWaitInt poll trigger
2018-11-09 14:57:42.871 4467-24946/? E/(FPLOG): 2.0.36.0 DeviceSetClock 1
2018-11-09 14:57:42.871 4467-24946/? E/(FPLOG): DeviceEnableInt 0 8 10 1
2018-11-09 14:57:43.382 27076-27076/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2018-11-09 14:57:43.453 4467-5872/? E/(FPLOG): 2.0.36.0 DeviceSetClock 0
2018-11-09 14:57:44.231 4720-5167/? E/LightsService: Light requested not available on this device. 2
2018-11-09 14:57:46.310 5182-5719/? E/ImsAdaptorImpl2: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:46.318 5182-5719/? E/ImsAdaptorImpl2: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:47.602 4720-5321/? E/ActivityManager: applyOptionsLocked: Unknown animationType=0
2018-11-09 14:57:47.603 4435-4505/? E/IptablesRestoreController: [iptables debug]iptables-restore execute *filter
    -D fw_standby_uid -m owner --uid-owner 15010042 -j DROP
    COMMIT
2018-11-09 14:57:47.621 27111-27111/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2018-11-09 14:57:47.623 4435-4505/? E/IptablesRestoreController: [iptables debug]iptables-restore execute done *filter
    -D fw_standby_uid -m owner --uid-owner 15010042 -j DROP
    COMMIT
    , res : 0
2018-11-09 14:57:47.873 27111-27111/? E/Mms/DbVersion: queryDbVersion,Elapsed time : 1.703346 ms
2018-11-09 14:57:47.875 27111-27111/? E/Mms/CsVersion: queryCsVersion,Elapsed time : 1.691577 ms
2018-11-09 14:57:48.101 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:48.109 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:48.198 4720-4804/? E/WindowManager: win=Window{f8d4643 u0 com.malik.testapplication/com.malik.testapplication.MapsActivity EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=false win.mRemoveOnExit=false win.mViewVisibility=8, caller=com.android.server.wm.AppWindowToken.destroySurfaces:748 com.android.server.wm.AppWindowToken.destroySurfaces:732 com.android.server.wm.WindowState.onExitAnimationDone:5523 com.android.server.wm.AppWindowAnimator.stepAnimationLocked:517 com.android.server.wm.AppWindowToken.stepAppWindowsAnimation:1745 
2018-11-09 14:57:48.217 27111-27135/? E/Mms/DbVersion: createMessagesProjection,Elapsed time : 0.265346 ms
2018-11-09 14:57:48.317 27147-27147/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2018-11-09 14:57:48.337 27160-27160/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2018-11-09 14:57:48.367 27111-27111/? E/Mms/DbUtils: rebuild done, 0 drafts,Elapsed time : 23.108961 ms
2018-11-09 14:57:48.367 27111-27142/? E/Mms/DbUtils: rebuild done, 0 drafts,Elapsed time : 23.291077 ms
2018-11-09 14:57:48.399 27111-27174/? E/PduPersister: sPersister is null
2018-11-09 14:57:48.408 27111-27111/? E/SamsungAnalytics111040: call after setConfiguration() method
2018-11-09 14:57:48.408 27111-27111/? E/SamsungAnalytics111040: context cannot be null
2018-11-09 14:57:48.461 4720-4849/? E/MotionRecognitionService:  Cancel reactive alert mode 
2018-11-09 14:57:48.462 4720-4849/? E/MotionRecognitionService:  handler : SCREEN_ON end
2018-11-09 14:57:48.503 27147-27147/? E/CS/CscParser: mps_code.dat does not exist
2018-11-09 14:57:48.503 27147-27147/? E/CS/CscParser: customer_path =/system/csc/customer.xml
2018-11-09 14:57:48.503 27147-27147/? E/CS/CscParser: fileName + /system/csc/customer.xml
2018-11-09 14:57:48.517 27147-27147/? E/CS/CscParser: mps_code.dat does not exist
2018-11-09 14:57:48.517 27147-27147/? E/CS/CscParser: customer_path =/system/csc/customer.xml
2018-11-09 14:57:48.517 27147-27147/? E/CS/CscParser: fileName + /system/csc/customer.xml
2018-11-09 14:57:48.532 27147-27147/? E/CS/CscParser: mps_code.dat does not exist
2018-11-09 14:57:48.532 27147-27147/? E/CS/CscParser: customer_path =/system/csc/customer.xml
2018-11-09 14:57:48.532 27147-27147/? E/CS/CscParser: fileName + /system/csc/customer.xml
2018-11-09 14:57:48.554 27147-27147/? E/CS/CscParser: mps_code.dat does not exist
2018-11-09 14:57:48.554 27147-27147/? E/CS/CscParser: customer_path =/system/csc/customer.xml
2018-11-09 14:57:48.554 27147-27147/? E/CS/CscParser: fileName + /system/csc/customer.xml
2018-11-09 14:57:48.563 27147-27147/? E/CS/CscParser: mps_code.dat does not exist
2018-11-09 14:57:48.563 27147-27147/? E/CS/CscParser: customer_path =/system/csc/customer.xml
2018-11-09 14:57:48.563 27147-27147/? E/CS/CscParser: fileName + /system/csc/customer.xml
2018-11-09 14:57:48.571 27147-27147/? E/CS/CscParser: mps_code.dat does not exist
2018-11-09 14:57:48.571 27147-27147/? E/CS/CscParser: customer_path =/system/csc/customer.xml
2018-11-09 14:57:48.571 27147-27147/? E/CS/CscParser: fileName + /system/csc/customer.xml
2018-11-09 14:57:48.578 27147-27147/? E/CS/CscParser: mps_code.dat does not exist
2018-11-09 14:57:48.578 27147-27147/? E/CS/CscParser: customer_path =/system/csc/customer.xml
2018-11-09 14:57:48.578 27147-27147/? E/CS/CscParser: fileName + /system/csc/customer.xml
2018-11-09 14:57:48.592 27111-27111/? E/Mms/BaseListItem: inflateContentLayout() - mContentType : 0
2018-11-09 14:57:48.743 27111-27111/? E/Mms/BaseListItem: inflateContentLayout() - mContentType : 0
2018-11-09 14:57:48.802 27111-27111/? E/Mms/TelephonyUtils: getImsRegistrationInfo ImsRegistration is null, UE is not registered on IMS network
2018-11-09 14:57:49.034 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:49.039 5182-5712/? E/ImsAdaptorImpl: setSSACInfo : ImsAdaptorImpl.
2018-11-09 14:57:49.109 4720-4804/? E/WindowManager: win=Window{2b8cae9 u0 Splash Screen com.samsung.android.messaging EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0, caller=com.android.server.wm.AppWindowToken.destroySurfaces:748 com.android.server.wm.AppWindowToken.destroySurfaces:732 com.android.server.wm.WindowState.onExitAnimationDone:5523 com.android.server.wm.WindowStateAnimator.stepAnimationLocked:553 com.android.server.wm.DisplayContent.lambda$-com_android_server_wm_DisplayContent_21292:465 
2018-11-09 14:57:49.252 27221-27221/? E//system/bin/webview_zygote32: Failed to make and chown /acct/uid_99449: Permission denied
2018-11-09 14:57:49.252 27221-27221/? E/Zygote: createProcessGroup(99449, 0) failed: Permission denied
2018-11-09 14:57:49.329 27240-27240/? E/asset: setgid: Operation not permitted
2018-11-09 14:57:49.425 5354-5397/? E/RequestManager_FLP: [FusedLocationApi] Location remove 136b4cb from com.malik.testapplication
2018-11-09 14:57:49.620 27111-27111/? E/Mms/TelephonyUtils: getImsRegistrationInfo ImsRegistration is null, UE is not registered on IMS network
2018-11-09 14:57:49.666 27254-27254/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2018-11-09 14:57:49.929 4720-5167/? E/LightsService: Light requested not available on this device. 2
2018-11-09 14:57:49.971 27221-27221/? E/Typeface: Error mapping font file /system/fonts/SamsungSans-Num3L.ttf
2018-11-09 14:57:49.971 27221-27221/? E/Minikin: Could not get cmap table size!
2018-11-09 14:57:49.971 27221-27221/? E/Typeface: Unable to load Family: samsung-sans-num3L:null
2018-11-09 14:57:49.972 27221-27221/? E/Typeface: Error mapping font file /system/fonts/SamsungSans-Num3T.ttf
2018-11-09 14:57:49.972 27221-27221/? E/Minikin: Could not get cmap table size!
2018-11-09 14:57:49.972 27221-27221/? E/Typeface: Unable to load Family: samsung-sans-num3T:null
2018-11-09 14:57:49.972 27221-27221/? E/Typeface: Error mapping font file /system/fonts/SamsungSans-Num4L.ttf
2018-11-09 14:57:49.972 27221-27221/? E/Minikin: Could not get cmap table size!
2018-11-09 14:57:49.972 27221-27221/? E/Typeface: Unable to load Family: samsung-sans-num4L:null
2018-11-09 14:57:49.972 27221-27221/? E/Typeface: Error mapping font file /system/fonts/SamsungSans-Num4T.ttf
2018-11-09 14:57:49.972 27221-27221/? E/Minikin: Could not get cmap table size!
2018-11-09 14:57:49.972 27221-27221/? E/Typeface: Unable to load Family: samsung-sans-num4T:null
2018-11-09 14:57:49.973 27221-27221/? E/Typeface: Error mapping font file /system/fonts/SamsungSans-Num35.ttf
2018-11-09 14:57:49.973 27221-27221/? E/Minikin: Could not get cmap table size!
2018-11-09 14:57:49.973 27221-27221/? E/Typeface: Unable to load Family: samsung-sans-num35:null
2018-11-09 14:57:49.973 27221-27221/? E/Typeface: Error mapping font file /system/fonts/SamsungSans-Num45.ttf
2018-11-09 14:57:49.973 27221-27221/? E/Minikin: Could not get cmap table size!
2018-11-09 14:57:49.973 27221-27221/? E/Typeface: Unable to load Family: samsung-sans-num45:null
2018-11-09 14:57:49.973 27221-27221/? E/Typeface: Error mapping font file /system/fonts/SamsungSans-Num3Lv.ttf
2018-11-09 14:57:49.973 27221-27221/? E/Minikin: Could not get cmap table size!
2018-11-09 14:57:49.973 27221-27221/? E/Typeface: Unable to load Family: samsung-sans-num3LV:null
2018-11-09 14:57:49.973 27221-27221/? E/Typeface: Error mapping font file /system/fonts/SamsungSans-Num3R.ttf
2018-11-09 14:57:49.974 27221-27221/? E/Minikin: Could not get cmap table size!
2018-11-09 14:57:49.974 27221-27221/? E/Typeface: Unable to load Family: samsung-sans-num3R:null
2018-11-09 14:57:49.975 27221-27221/? E/Typeface: Error mapping font file /system/fonts/SamsungSans-Num4Tv.ttf
2018-11-09 14:57:49.975 27221-27221/? E/Minikin: Could not get cmap table size!
2018-11-09 14:57:49.975 27221-27221/? E/Typeface: Unable to load Family: samsung-sans-num4Tv:null
2018-11-09 14:57:49.975 27221-27221/? E/Typeface: Error mapping font file /system/fonts/SamsungSans-Num4Lv.ttf
2018-11-09 14:57:49.975 27221-27221/? E/Minikin: Could not get cmap table size!
2018-11-09 14:57:49.975 27221-27221/? E/Typeface: Unable to load Family: samsung-sans-num4Lv:null
2018-11-09 14:57:50.049 27254-27254/? E/libc: Access denied finding property "ro.serialno"
2018-11-09 14:57:50.050 4407-4407/? E/audit: type=1400 audit(1541757470.041:24571): avc:  denied  { read } for  pid=27254 comm="ndroid.incallui" name="u:object_r:serialno_prop:s0" dev="tmpfs" ino=10419 scontext=u:r:radio:s0 tcontext=u:object_r:serialno_prop:s0 tclass=file permissive=0 SEPF_SM-J530F_8.1.0_0005 audit_filtered
2018-11-09 14:57:50.050 4407-4407/? E/audit: type=1300 audit(1541757470.041:24571): arch=40000028 syscall=322 per=8 success=no exit=-13 a0=ffffff9c a1=ffe00cb0 a2=a8000 a3=0 items=0 ppid=4417 pid=27254 auid=4294967295 uid=1001 gid=1001 euid=1001 suid=1001 fsuid=1001 egid=1001 sgid=1001 fsgid=1001 tty=(none) ses=4294967295 comm="ndroid.incallui" exe="/system/bin/app_process32" subj=u:r:radio:s0 key=(null)
2018-11-09 14:57:50.050 4407-4407/? E/audit: type=1327 audit(1541757470.041:24571): proctitle="com.samsung.android.incallui"
2018-11-09 14:57:50.079 27254-27254/? E/CscParser: getCustomerPath : customer file exist
2018-11-09 14:57:50.079 27254-27254/? E/CscParser: getCustomerPath : customer file exist
2018-11-09 14:57:50.080 27254-27254/? E/CscParser: fileName + /system/csc/customer.xml
2018-11-09 14:57:50.139 27254-27254/? E/CscParser: getOthersPath : others file exist
2018-11-09 14:57:50.139 27254-27254/? E/CscParser: getCustomerPath : customer file exist
2018-11-09 14:57:50.139 27254-27254/? E/CscParser: getOthersPath : others file exist
2018-11-09 14:57:50.139 27254-27254/? E/CscParser: fileName + /system/csc/others.xml
2018-11-09 14:57:50.142 27254-27254/? E/CscParser: getCustomerPath : customer file exist
2018-11-09 14:57:50.142 27254-27254/? E/CscParser: getOthersPath : others file exist
2018-11-09 14:57:50.142 27254-27254/? E/CscParser: update(/carrier/chameleon.xml): file not exist
2018-11-09 14:57:50.143 27254-27254/? E/CscParser: getCustomerPath : customer file exist
2018-11-09 14:57:50.143 27254-27254/? E/CscParser: fileName + /system/csc/customer.xml
2018-11-09 14:57:50.196 27254-27254/? E/CscParser: getCustomerPath : customer file exist
2018-11-09 14:57:50.196 27254-27254/? E/CscParser: fileName + /system/csc/customer.xml
2018-11-09 14:57:50.211 27254-27254/? E/CscParser: getCustomerPath : customer file exist
2018-11-09 14:57:50.211 27254-27254/? E/CscParser: fileName + /system/csc/customer.xml
2018-11-09 14:57:50.226 27254-27254/? E/CscParser: getCustomerPath : customer file exist
2018-11-09 14:57:50.226 27254-27254/? E/CscParser: fileName + /system/csc/customer.xml
2018-11-09 14:57:50.272 5354-5397/? E/RequestManager_FLP: [FusedLocationApi] Location request a845bc1 PRIORITY_HIGH_ACCURACY interval=5000 from com.malik.testapplication
2018-11-09 14:57:50.349 27111-27111/? E/Mms/TelephonyUtils: getImsRegistrationInfo ImsRegistration is null, UE is not registered on IMS network
2018-11-09 14:57:50.407 27111-27176/? E/Mms/NotificationChannelManager: [CONVCHANNEL] doSyncChannelAllConversations end,Elapsed time : 10.869269 ms
2018-11-09 14:57:50.528 27254-27254/? E/CarrierMatchingUtils: 

1 Ответ

0 голосов
/ 09 ноября 2018
val fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(context)
val locationRequest = LocationRequest()
val locationSettingsRequest = LocationSettingsRequest.Builder().addLocationRequest(locationRequest).build()
val client = LocationServices.getSettingsClient(context).checkLocationSettings(locationSettingsRequest)
        client.addOnSuccessListener {
            fusedLocationProviderClient.requestLocationUpdates(locationRequest, object : LocationCallback() {
                override fun onLocationResult(locationResult: LocationResult) {
                    locationResult
                }
            }, Looper.myLooper())
        }.addOnFailureListener { exception ->
            //Do something
        }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...