M
M
matveyboyko2018-02-25 13:41:32
Android
matveyboyko, 2018-02-25 13:41:32

How to use Smart Location Library for Android?

Hello!
As a novice android developer, I'm trying to use the Smart Location Library to determine coordinates.
I found the Smart Location Library , how to use it until I figure it out.
In accordance with the documentation, I connected the dependency in build.gragle, performed sync.
Now in onCreate I paste the code:

SmartLocation.with(context).location()
    .start(new OnLocationUpdatedListener() {
});

However, context is highlighted in red. What to put in there?
While there is no understanding, as a beginner.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2018-02-25
@matveyboyko

Context is an activity in this case. You can replace with this. In addition, it is not known how long this lib holds the context, a memory leak is possible. You can replace it with getApplicationContext() - application is the longest living application context.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question