mobile/src/main/java/drost_stein/fbg/hsbo/de/urbantrackingapp/MainActivity.java
public void startTracking() {
        if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.ACCESS_COARSE_LOCATION)
                != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this,
                Manifest.permission.ACCESS_FINE_LOCATION)
                != PackageManager.PERMISSION_GRANTED) {

            ActivityCompat.requestPermissions(this,
                    new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, 0);
        } else {
            mMenu.getItem(0).setIcon(getResources().getDrawable(R.drawable.ic_gps_fixed_white_48dp));
            mLocationServiceIntent.putExtra("updateInterval", getUpdateIntervalFromPreferences());
            mLocationServiceIntent.putExtra("userId", mUserID);
            startService(mLocationServiceIntent);
            doBindLocationService();
        }
    }
/**
     * Starts the tracking if the permission was granted
     */
Starts the tracking if the permission was granted
Starts the tracking if the permission was granted
public void startTracking() {
        if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.ACCESS_COARSE_LOCATION)
                != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this,
                Manifest.permission.ACCESS_FINE_LOCATION)
                != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(this,
                    new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}, 0);
        } else {
            mMenu.getItem(0).setIcon(getResources().getDrawable(R.drawable.ic_gps_fixed_white_48dp));
            mLocationServiceIntent.putExtra("updateInterval", getUpdateIntervalFromPreferences());
            mLocationServiceIntent.putExtra("userId", mUserID);
            startService(mLocationServiceIntent);
            doBindLocationService();
        }
    }
public void startTracking ( ) { if ( ContextCompat . checkSelfPermission ( this , Manifest . permission . ACCESS_COARSE_LOCATION ) != PackageManager . PERMISSION_GRANTED || ContextCompat . checkSelfPermission ( this , Manifest . permission . ACCESS_FINE_LOCATION ) != PackageManager . PERMISSION_GRANTED ) { ActivityCompat . requestPermissions ( this , new String [ ] { Manifest . permission . ACCESS_COARSE_LOCATION , Manifest . permission . ACCESS_FINE_LOCATION } , 0 ) ; } else { mMenu . getItem ( 0 ) . setIcon ( getResources ( ) . getDrawable ( R . drawable . ic_gps_fixed_white_48dp ) ) ; mLocationServiceIntent . putExtra ( "updateInterval" , getUpdateIntervalFromPreferences ( ) ) ; mLocationServiceIntent . putExtra ( "userId" , mUserID ) ; startService ( mLocationServiceIntent ) ; doBindLocationService ( ) ; } }
Starts the tracking if the permission was granted
Starts the tracking if the permission was granted