Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void startGPS(View view)
- {
- // Here is the code to handle permissions - you should not need to edit this.
- if ( Build.VERSION.SDK_INT >= 23 &&
- ContextCompat.checkSelfPermission( this, android.Manifest.permission.ACCESS_FINE_LOCATION ) != PackageManager.PERMISSION_GRANTED &&
- ContextCompat.checkSelfPermission( this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
- ActivityCompat.requestPermissions(this, new String[] { android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_COARSE_LOCATION }, TAKE_PHOTO_PERMISSION);
- }
- locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
- Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
- onLocationChanged(location);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement