我最近在Google Play上看到了这个应用
https://play.google.com/store/apps/details?id=com.androidlost&hl=fr
我特别感兴趣知道它是怎么做的那种东西? (知道出于安全原因,您通常无法使用Android SDK ...)
* start/stop GPS
* start/stop WIFI
是否有任何一种技巧可以让它成为可能?
谢谢
答案 0 :(得分:1)
启用/禁用GPS以编程方式查看this和Wifi:
String provider = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
final Intent poke = new Intent();
poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider");
poke.addCategory(Intent.CATEGORY_ALTERNATIVE);
poke.setData(Uri.parse("0"));
int wifistatus = ((WifiManager)con.getSystemService(Context.WIFI_SERVICE)).getWifiState();
if(wifistatus==1) //if WIFI is disabled
{
sendBroadcast(poke);
}
else //if WIFI is enable
{
sendBroadcast(poke);
}
manifest.xml权限:
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>