خرید بک لینک

سلام دوستان
کسی کدی برای روشن کردن gps داره
من این کد رو پیدا کردم اما من میخام سنسور gps روشن بشه ن قسمت wifi gps

public void tuGPSOn() {
try {
Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE");
intent.putExtra("enabled", true);
this.sendBroadcast(intent);

String provider = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
if (!provider.contains("gps")) { //if gps is disabled
final Intent poke = new Intent();
poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProv ider");
poke.addCategory(Intent.CATEGORY_ALTERNATIVE);
poke.setData(Uri.parse("2"));
this.sendBroadcast(poke);

}
} catch (Exception e) {

}

// getLocationGPS();
}

برچسب: نویسنده: محمد رضا جوادیان تاريخ: شنبه 11 ارديبهشت 1395 ساعت: 20:27

صفحه بندی