delight-im / Android-SimpleLocation

Utility class for easy access to the device location on Android
Apache License 2.0
200 stars 75 forks source link

Cannot resolve method 'getTimestampInMilliseconds()' #39

Closed dbao7 closed 4 years ago

dbao7 commented 4 years ago

Hi. I am getting the error Cannot resolve method 'getTimestampInMilliseconds() when trying to call that method. The same error occurred for the getElapsedTimeInNanoseconds() method. Any idea? getSpeed(), getPosition(), and other methods work fine.


import im.delight.android.location.SimpleLocation;

public class MainActivity extends AppCompatActivity {

    private SimpleLocation mLocation;

    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mLocation = new SimpleLocation(this);
        mLocation.setBlurRadius(5000);

        if (!mLocation.hasLocationEnabled()) {
            SimpleLocation.openSettings(this);
        }

        final long timestampInMilliseconds = mLocation.getTimestampInMilliseconds();
        final long elapsedTimeInNanoseconds = mLocation.getElapsedTimeInNanoseconds();
    }

    @Override
    protected void onResume() {
        super.onResume();
        mLocation.beginUpdates();
    }

    @Override
    protected void onPause() {
        mLocation.endUpdates();
        super.onPause();
    }
}
ocram commented 4 years ago

Thanks for your feedback!

Did you use the following?

compile 'com.github.delight-im:Android-SimpleLocation:v1.0.1'

Could you try to change the version number?

compile 'com.github.delight-im:Android-SimpleLocation:v1.1.0'
dbao7 commented 4 years ago

@ocram The new version number solved the issue. Thank you.

ocram commented 4 years ago

Fixed in the README. Thank you!