I need to check current user location every 10 minutes even if user turned off the screen or closed app (not Force stop). For start of LocationCheckService I'm using AlarmService, but it's start to checking location always (onLocationChanged, for example). How to make only one request for location update every 10 minutes (without onLocationChanged every time) via Network or GPS provider?
MainActivity
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(this, LocationCheckService.class);
PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), 0, intent, 0);
manager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 100, 200, pendingIntent);
}
}
LocationCheckService.class
public class LocationCheckService extends Service {
LocationManager locationManager = null;
#SuppressLint("MissingPermission")
#Override
public void onCreate() {
locationManager = (LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 0, new LocationListener(LocationManager.NETWORK_PROVIDER));
new Timer().schedule(new MyTimer(), 0, 10000);
}
#SuppressLint("MissingPermission")
class MyTimer extends TimerTask {
#SuppressLint("MissingPermission")
#Override
public void run() {
try {
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
List<Address> listAddress = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
if (listAddress != null && listAddress.size() > 0)
Log.d(TAG, listAddress.get(0).getCountryCode());
listAddress = geocoder.getFromLocation(1.3707295, 32.3032414, 1);
if (listAddress != null && listAddress.size() > 0)
Log.d(TAG, listAddress.get(0).getCountryCode());
} catch (IOException e) {
e.printStackTrace();
}
}
}
#Nullable
#Override
public IBinder onBind(Intent intent) {
return null;
}
private class LocationListener implements android.location.LocationListener {
Location mLastLocation;
public LocationListener(String provider) {
Log.e(TAG, "LocationListener " + provider);
mLastLocation = new Location(provider);
}
#Override
public void onLocationChanged(Location location) {
Log.e(TAG, "onLocationChanged: " + location);
mLastLocation.set(location);
}
#Override
public void onProviderDisabled(String provider) {
Log.e(TAG, "onProviderDisabled: " + provider);
}
#Override
public void onProviderEnabled(String provider) {
Log.e(TAG, "onProviderEnabled: " + provider);
}
#Override
public void onStatusChanged(String provider, int status, Bundle extras) {
Log.e(TAG, "onStatusChanged: " + provider);
}
}
}
Related
I have facing issue in Android 10 to get location in every 10 minutes when app in background or app is killed. Till android 9 pie everything is working correct but in android 10 when app goes in background in few seconds onDestory() method is called in service and service is destroying. How can i reslove this issue and start service in background. Here is my service class :
public class LocaionTrackingService extends Service {
private static final String TAG = "LocaionTrackingService";
private LocationManager mLocationManager = null;
private static final int LOCATION_INTERVAL = Common.LOCATION_TIME_INTERVAL;
private static final float LOCATION_DISTANCE = 0;
private Context mContext;
boolean checkGPS = false;
boolean checkNetwork = false;
Location loc;
public static final int notify = Common.LOCATION_TIME_INTERVAL; //interval between two services(Here Service run every 5 Minute)
private Handler mHandler = new Handler(); //run on another Thread to avoid crash
private Timer mTimer = null;
private class LocationListener implements android.location.LocationListener {
Location mLastLocation;
public LocationListener(String provider) {
Common.printLog(TAG, "LocationListener " + provider);
mLastLocation = new Location(provider);
}
#Override
public void onLocationChanged(Location location) {
if (location != null) {
Common.printLog(TAG, "onLocationChanged: " + location + "\n" + "Lat:" + location.getLatitude() + "\nLang:" + location.getLongitude());
mLastLocation.set(location);
try {
Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
List<Address> addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
if (addresses.size() > 0) {
String address = Common.getFullAddressFromGeoCoder(addresses.get(0));
PreferenceData.setLocationData(String.valueOf(location.getLatitude()), String.valueOf(location.getLongitude()), address);
Common.printLog(TAG, "->address" + address);
}
sendLatLong(location.getLatitude() + "", location.getLongitude() + "", PreferenceData.getAddress(), Common.isGPSON(getApplicationContext()) ? "1" : "0");
} catch (Exception e) {
e.printStackTrace();
}
}
}
#Override
public void onProviderDisabled(String provider) {
Common.printLog(TAG, "onProviderDisabled: " + provider);
}
#Override
public void onProviderEnabled(String provider) {
Common.printLog(TAG, "onProviderEnabled: " + provider);
}
#Override
public void onStatusChanged(String provider, int status, Bundle extras) {
Common.printLog(TAG, "onStatusChanged: " + provider);
}
}
LocationListener[] mLocationListeners = new LocationListener[]{
new LocationListener(LocationManager.GPS_PROVIDER),
new LocationListener(LocationManager.NETWORK_PROVIDER)
};
#Override
public IBinder onBind(Intent arg0) {
throw new UnsupportedOperationException("Not yet implemented");
}
#Override
public int onStartCommand(Intent intent, int flags, int startId) {
Common.printLog(TAG, "onStartCommand");
super.onStartCommand(intent, flags, startId);
return START_STICKY;
}
#Override
public void onCreate() {
Common.printLog(TAG, "onCreate");
initializeLocationManager();
setLastLocation();
if (mTimer != null) // Cancel if already existed
mTimer.cancel();
else
mTimer = new Timer(); //recreate new
mTimer.scheduleAtFixedRate(new TimeDisplay(), 0, notify); //Schedule task
}
void getAddressfromGeocoder(double Latitude, double Longitude) {
try {
Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
List<Address> addresses = null;
addresses = geocoder.getFromLocation(Latitude, Longitude, 1);
if (addresses.size() > 0) {
String address = Common.getFullAddressFromGeoCoder(addresses.get(0));
PreferenceData.setLocationData(String.valueOf(Latitude), String.valueOf(Longitude), address);
Common.printLog(TAG, "tag->getAddressfromGeocoder :" + address + "\nLatitude" + Latitude + "\nLongitude" + Longitude);
}
} catch (IOException e) {
e.printStackTrace();
}
}
void setLastLocation() {
try {
if (!checkGPS && !checkNetwork) {
//Toast.makeText(mContext, "No Service Provider is available", Toast.LENGTH_SHORT).show();
} else {
if (checkGPS && !PreferenceData.getLastLAN().equals("") && !PreferenceData.getLastLAT().equals("")) {
Common.printLog(TAG, "check For GPS");
mLocationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER, LOCATION_INTERVAL, LOCATION_DISTANCE,
mLocationListeners[0]);
if (mLocationListeners != null) {
loc = mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (loc != null) {
getAddressfromGeocoder(loc.getLatitude(), loc.getLongitude());
}
}
} else if (checkNetwork) {
Common.printLog(TAG, "check For Network");
mLocationManager.requestLocationUpdates(
LocationManager.NETWORK_PROVIDER, LOCATION_INTERVAL, LOCATION_DISTANCE,
mLocationListeners[1]);
if (mLocationListeners != null) {
loc = mLocationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (loc != null) {
getAddressfromGeocoder(loc.getLatitude(), loc.getLongitude());
}
}
}
}
} catch (java.lang.SecurityException ex) {
Common.printLog(TAG, "fail to request location update, ignore" + ex);
} catch (IllegalArgumentException ex) {
Common.printLog(TAG, "gps provider does not exist " + ex.getMessage());
}
}
#Override
public void onDestroy() {
Common.printLog(TAG, "onDestroy");
super.onDestroy();
mTimer.cancel();
if (mLocationManager != null) {
for (int i = 0; i < mLocationListeners.length; i++) {
try {
mLocationManager.removeUpdates(mLocationListeners[i]);
} catch (Exception ex) {
Common.printLog(TAG, "fail to remove location listners, ignore" + ex);
}
}
}
}
private void initializeLocationManager() {
Common.printLog(TAG, "initializeLocationManager");
if (mLocationManager == null) {
mLocationManager = (LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
// get GPS status
checkGPS = mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
// get network provider status
checkNetwork = mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
}
}
void sendLatLong(final String Lat, final String Long, final String address, final String isLocationOn) {
if (NetworkUtil.getConnectivityStatus(getApplicationContext()) != 0) {
String url = Common.LIVE_EMP_TRACK;
Common.printLog(TAG, "url->" + url);
StringRequest strReq = new StringRequest(Request.Method.POST,
url, new Response.Listener<String>() {
#Override
public void onResponse(String response) {
Common.printLog(TAG + "->response", response);
PreferenceData.setLocationData(Lat, Long, address);
PreferenceData.setLastUpdateLocation(System.currentTimeMillis());
}
}, new Response.ErrorListener() {
#Override
public void onErrorResponse(VolleyError error) {
//Common.printLog(TAG, String.valueOf(Common.getErrorMsg(mContext, error, null)));
PreferenceData.setLastUpdateLocation(System.currentTimeMillis());
}
}) {
#Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
params.put("Latitude", Lat);
params.put("Longitude", Long);
params.put("Location", address);
params.put("isLocationOn", isLocationOn);
params.put("EmpId", PreferenceData.getUserBy());
return params;
}
#Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("API-Key", BuildConfig.KEY);
params.put("Clientip", PreferenceData.getIpAddress());
params.put("Userid", PreferenceData.getUserId());
return params;
}
};
VolleySingleton.getInstance(getApplicationContext()).addToRequestQueue(strReq);
} else {
Common.printLog("Service", "No network");
}
}
//class TimeDisplay for handling task
class TimeDisplay extends TimerTask {
#Override
public void run() {
// run on another thread
mHandler.post(new Runnable() {
#Override
public void run() {
setLastLocation();
Common.printLog(TAG, "Location Service running-" + Calendar.getInstance().getTimeInMillis());
//Toast.makeText(LocaionTrackingService.this, "Service is running", Toast.LENGTH_SHORT).show();
sendLatLong(PreferenceData.getLastLAT(), PreferenceData.getLastLAN(), PreferenceData.getAddress(), Common.isGPSON(getApplicationContext()) ? "1" : "0");
}
});
}
}
}
Due to the android's limitations for background tasks in post-O devices, background services are destroyed by the android system if the app is in the background for some time. You should use startForeground() in onStartCommand() to start the service as a foreground service and also show the notification for the same.
I have created background service to get user location periodically and send it to server like this :`
public class SyncDataToServerService extends Service {
private static final String TAG = "SyncDataToServerService";
private ServerCall serverCall;
private SharedPreferences tempPref2;
private Timer timer;
LocationManager locationManager;
UtilityClass utilityClass;
PowerManager.WakeLock wakeLock;
PowerManager powerManager;
#Override
public void onCreate() {
Log.e(TAG, "onCreate");
serverCall = new ServerCall(this);
timer = new Timer();
utilityClass = new UtilityClass(this);
tempPref2 = getSharedPreferences(getString(R.string.temp_pref_name_2), Context.MODE_PRIVATE);
}
#SuppressLint("MissingPermission")
#Override
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
Log.e(TAG, "onStartCommand");
powerManager = (PowerManager) getSystemService(POWER_SERVICE);
if (powerManager != null)
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
"MyApp::MyWakelockTag");
wakeLock.acquire();
//initialize and start Location service
startLocation();
//initialize and start the TimerTask's job
startTimer();
return START_STICKY;
}
#SuppressLint("MissingPermission")
private void startLocation() {
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
if (locationManager != null)
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
10, new MyLocationListener());
if (locationManager != null)
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0,
10, new MyLocationListener());
}
#Override
public IBinder onBind(Intent arg0) {
return null;
}
#Override
public void onDestroy() {
Log.e(TAG, "onDestroy");
if (locationManager != null)
locationManager.removeUpdates(new MyLocationListener());
super.onDestroy();
}
private void syncPath(Location mLocation) {
Log.w(TAG, "Location: " + mLocation + " Latitude: " + mLocation.getLatitude() + " & Longitude: "
+ mLocation.getLongitude());
if (tempPref2.getString(getString(R.string.attendance_key), "").equalsIgnoreCase("present")) {
serverCall.sendEmpPath(mLocation);
}
}
private void startTimer() {
TimerTask timerTask = new TimerTask() {
#RequiresApi(api = Build.VERSION_CODES.KITKAT)
public void run() {
if (utilityClass.isInternetConnected()) {
if (serverCall != null) {
if (serverCall.requestQ.size() > 0)
Log.e(TAG, "Request queue size ==" + serverCall.requestQ.size());
serverCall.syncData();
}
}
}
};
//schedule the timer, to wake up every 1 second
timer.schedule(timerTask, 1000, 1000);
}
private class MyLocationListener implements LocationListener {
#Override
public void onLocationChanged(Location location) {
Log.e(TAG, "onLocationChanged: " + location);
Intent intent1 = new Intent("com.example.mc_project");
intent1.putExtra("location", location);
sendBroadcast(intent1);
if (location.getAccuracy() < 25)
syncPath(location);
wakeLock.release();
}
#Override
public void onStatusChanged(String s, int i, Bundle bundle) {
}
#Override
public void onProviderEnabled(String s) {
}
#Override
public void onProviderDisabled(String s) {
}
}
}`
everything working fine but when i lock my phone it stop to send location updates. i have read that it is because of system sleep and have to use wake lock but it also not working.And when i unlock phone it suppose to start to send location updates but this also not happening.My service do not stop,it always in running state.Please help where i am doing wrong or missing something.
you should use foreground service and put location update code inside it .
os stops background service any time power is off
I try to make a locationing service but somehow i cant make it work.
Lat and Lng are always NULL.
I had some exceptions on locManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locListener); so i put it inside a run() method, now exception is gone. What could be the problem?
So what is the solution to make a locationing service work?
Code:
public class LocationService extends Service {
private Timer timer = new Timer();
private LocationManager locManager;
private LocationListener locListener = new MyLocationListener();
private String latitude;
private String longitude;
private String providerToSend;
Messenger messenger;
Timer t = new Timer();
#Override
public IBinder onBind(Intent arg0) {
return null;
}
public void onCreate() {
super.onCreate();
locListener = new MyLocationListener();
locationProviderInit();
startService();
}
#Override
public void onDestroy() {
super.onDestroy();
shutdownService();
}
private void startService() {
locManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
String token = new SharedPreffer(this).loadPreferences("token");
Log.d("Debug - token: ", "Van Token: " + token);
t.schedule(new TimerTask() {
#Override
public void run() {
locationProviderInit();
if (latitude != null && longitude != null) {
Log.d("Debug - lat: ", latitude);
Log.d("Debug - lng: ", longitude);
} else {
Log.d("Debug - lat and lng are: ", "NULL");
}
}
}, 0, 5000);
}
private void locationProviderInit() {
new Runnable() {
#Override
public void run() {
try {
boolean gps_enabled = locManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
boolean network_enabled = locManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
if (gps_enabled) {
locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locListener);
providerToSend = LocationManager.GPS_PROVIDER;
}
if (network_enabled) {
locManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locListener);
providerToSend = LocationManager.NETWORK_PROVIDER;
}
} catch (Exception e) {
Log.d("Debug", e.toString());
}
}
};
}
class MyLocationListener implements LocationListener {
public void onLocationChanged(Location location) {
if (location != null) {
longitude = Double.toString(location.getLongitude());
latitude = Double.toString(location.getLatitude());
}
}
public void onProviderDisabled(String arg) {
}
public void onProviderEnabled(String arg) {
}
public void onStatusChanged(String provider, int status, Bundle extras) {
}
}
private void shutdownService() {
if (timer != null)
timer.cancel();
Log.i(getClass().getSimpleName(), "Timer stopped!!!");
}
}
you don't execute the Runnable in locationProviderInit...
Have you tried to put a debug message inside the method run() within the Runnable object, and see if it has been ever executed?
Defining a Runnable instance without using it ,e.g. within a thread, won't work.
Here are few examples of open source GPS logging services that you can use as guide.
GPSLoggerService
GPSLoggingService
My Andoid application contains many activities. I want to run a background process that is independent of these activities (no matter whichever activity is running on UI). In this background process, I want to capture Location Updates using LocationListener and want to call web service to store the captured location in the database. And this calling of webservice has to happen only in 2 min interval. Can someone please help me in implementing this.
Thanks.
Android developer
Check this
public class LocationUpdator extends Service{
Location location;
private int normallocationwait = 2000;
Timer timer = new Timer();
private final Handler handler = new Handler();
Intent intent;
public void onCreate(){
super.onCreate();
intent = new Intent(BROADCAST_ACTION);
updateNotification();
}
//int onStartCommand(Intent intent, int flags, int startId)
public void onStart(Intent intent,int startId){
super.onStart(intent, startId);
handler.removeCallbacks(sendUpdatesToUI);
handler.postDelayed(sendUpdatesToUI, 1000); // 1 second
Log.v("Location Servics", "Start Service");
}
public void onDestroy(){
super.onDestroy();
Log.v("Location Servics", "Destroy Service");
}
protected void updateNotification() {
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
LocationListener locationListener = new MyLocationlistener();
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, normallocationwait, 0.250f, locationListener);
location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
}
private class MyLocationlistener implements LocationListener {
public void onLocationChanged(Location location){
if(location!=null){
dumpLocation(location);
}
}
public void onProviderDisabled(String provider){
Log.v("Loc Update","\nProvider disabled: " + provider);
}
public void onProviderEnabled(String provider){
Log.v("Loc Update","\nProvider enabled: " + provider);
}
public void onStatusChanged(String provider, int status, Bundle extras){
Log.v("Loc Update","\nProvider status changed: " + provider + ", status="
+ status + ", extras=" + extras);
}
private void dumpLocation(Location location) {
Log.v("Loc Update","\n" + location.toString());
Log.v("Demo", location.toString());
if(GlobalValues.whereRegister == 1){
String url = TaxiUrls.taxiLocationUpdate_url + "taxi_device_id="+ GlobalValues.deviceID +
"&lat="+ location.getLatitude() + "&lng=" + location.getLongitude();
Toast.makeText(getBaseContext(), "Location Update", Toast.LENGTH_SHORT).show();
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
try {
HttpResponse response = httpclient.execute(httppost);
Log.v("Message", response.toString());
} catch (ClientProtocolException e) {
Log.e("Sending Message",e.getMessage().toString());
} catch (IOException e) {
Log.e("Sending Message",e.getMessage().toString());
}
}
}
}
}
Maybe worth launching a simple AsyncTask to do this in the background.
Am working on an app, which toasts the latitude and longitude using LocationManager and LocationListener. On running the app, an error shows up saying "Sorry, Process system is not responding.". This happens when I supply the lat and long either manually from emulator control under DDMS or from command prompt using telnet.
Java Code:
public class LocationFinder extends Activity {
private LocationManager locManager;
private LocationListener locListener;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
locManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
locListener = new MyLocationListener();
locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locListener);
}
private class MyLocationListener implements LocationListener{
#Override
public void onLocationChanged(Location loc) {
// TODO Auto-generated method stub
if(loc != null){
Toast.makeText(getBaseContext(), "Latitude: " + loc.getLatitude() + "Longitude: " + loc.getLongitude(), Toast.LENGTH_SHORT).show();
}
}
#Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
#Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
#Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
}
}
And I have set the following permissions in manifest.xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" />
The emulator is also hw.gps enabled.
I would like to know if there is anything wrong with my code.
Thanks
Check by using Log that you are getting Values for Latitude and longitude..
Then in Toast put this
Toast.makeText(LocationFinder.this, "Latitude: " + loc.getLatitude() + "Longitude: " + loc.getLongitude(), Toast.LENGTH_SHORT).show();
instead of
Toast.makeText(getBaseContext(), "Latitude: " + loc.getLatitude() + "Longitude: " + loc.getLongitude(), Toast.LENGTH_SHORT).show();
// Des: Start Device's GPS and get current latitude and longitude
public void GPS() throws IOException {
// Des: This is a background service and called after every 10 minutes and fetch latitude-longitude values
background = new Thread(new Runnable() {
#Override
public void run() {
for (int i = 0; i < j; i++) {
if (ProjectStaticVariable.GPSExit == true ) {
try {
Thread.sleep(600000); //10 minutes
mainhandler.sendMessage(mainhandler.obtainMessage());
j++;
}
catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}
}
});
background.start();
mainhandler = new Handler() {
public void handleMessage(Message msg) {
// Check Internet status
isInternetPresent = cd.isConnectingToInternet();
if (isInternetPresent) {
lat_long_Service_flag = true;
mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
mlocListener = new MyLocationListener(getApplicationContext());
mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 0, mlocListener);
mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
}
}
};
}
// Des: Location Listener through which we get current latitude and longitude
public class MyLocationListener implements LocationListener {
public MyLocationListener(Context mContext) {}
public MyLocationListener(Runnable runnable) {}
#Override
public void onLocationChanged(Location loc) {
longitude = loc.getLongitude();
latitude = loc.getLatitude();
final_latitude = Double.toString(latitude);
final_longitude = Double.toString(longitude);
}
#Override
public void onProviderDisabled(String provider) {
}
#Override
public void onProviderEnabled(String provider) {
}
#Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
}