Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
KeepMeSafe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vivek s
KeepMeSafe
Commits
9b4c8d9e
Commit
9b4c8d9e
authored
8 years ago
by
SubashNS
Browse files
Options
Downloads
Patches
Plain Diff
Material Design
parent
a0b99d92
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/main/java/com/speedyapps/keepyousafe/GpsTool.java
+87
-0
87 additions, 0 deletions
app/src/main/java/com/speedyapps/keepyousafe/GpsTool.java
app/src/main/res/mipmap-xxhdpi/kms.png
+0
-0
0 additions, 0 deletions
app/src/main/res/mipmap-xxhdpi/kms.png
with
87 additions
and
0 deletions
app/src/main/java/com/speedyapps/keepyousafe/GpsTool.java
0 → 100644
+
87
−
0
View file @
9b4c8d9e
package
com.speedyapps.keepyousafe
;
/**
* Created by SUBASH on 18-04-2017.
*/
import
android.content.Context
;
import
android.content.Intent
;
import
android.location.Location
;
import
android.location.LocationListener
;
import
android.location.LocationManager
;
import
android.os.Bundle
;
import
android.provider.Settings
;
/**
* Created by pethoalpar on 4/13/2016.
*/
public
class
GpsTool
{
String
locationProvider
=
LocationManager
.
GPS_PROVIDER
;
private
LocationManager
locationManager
;
private
LocationListener
locationListener
;
public
GpsTool
(
Context
context
){
locationManager
=
(
LocationManager
)
context
.
getSystemService
(
Context
.
LOCATION_SERVICE
);
this
.
turnOnGps
(
context
);
locationListener
=
new
LocationListener
()
{
@Override
public
void
onLocationChanged
(
Location
location
)
{
onGpsLocationChanged
(
location
);
location
.
reset
();
}
@Override
public
void
onStatusChanged
(
String
provider
,
int
status
,
Bundle
extras
)
{
onGpsStatusChanged
(
provider
,
status
,
extras
);
}
@Override
public
void
onProviderEnabled
(
String
provider
)
{
onGpsProviderEnabled
(
provider
);
}
@Override
public
void
onProviderDisabled
(
String
provider
)
{
onGpsProviderDisabled
(
provider
);
}
};
startGpsUpdate
();
}
public
void
onGpsLocationChanged
(
Location
location
)
{
//Location change.
}
public
void
onGpsStatusChanged
(
String
provider
,
int
status
,
Bundle
extras
)
{
}
public
void
onGpsProviderEnabled
(
String
provider
)
{
}
public
void
onGpsProviderDisabled
(
String
provider
)
{
}
public
Location
getLocation
(){
return
locationManager
.
getLastKnownLocation
(
locationProvider
);
}
public
void
startGpsUpdate
(){
locationManager
.
requestLocationUpdates
(
locationProvider
,
1000
,
0
,
locationListener
);
}
public
void
stopGpsUpdate
(){
locationManager
.
removeUpdates
(
locationListener
);
}
public
void
turnOnGps
(
Context
context
){
boolean
isEnabled
=
locationManager
.
isProviderEnabled
(
locationProvider
);
if
(!
isEnabled
){
Intent
intent
=
new
Intent
(
Settings
.
ACTION_LOCATION_SOURCE_SETTINGS
);
context
.
startActivity
(
intent
);
}
}
}
This diff is collapsed.
Click to expand it.
app/src/main/res/mipmap-xxhdpi/kms.png
0 → 100644
+
0
−
0
View file @
9b4c8d9e
29 KiB
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment