ほとんどの場合、ユーザーの場所を知る必要があるアプリがあります。私は場所にアクセスする必要がある場合Wi-Fiをオンにするようにユーザーに依頼する
、私はこれを行う:
final AlertDialog.Builder builder = new AlertDialog.Builder(
MapScreen.this);
builder.setTitle("MyAppName");
builder.setMessage("The location service is off. Do you want to turn it on?");
builder.setPositiveButton("Enable location",
new DialogInterface.OnClickListener() {
@Override
public void onClick(
final DialogInterface dialogInterface,
final int i) {
startActivity(new Intent(
android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
}
});
builder.setNegativeButton("Continue without location", null);
builder.create().show();
しかし、GPSは、私には十分常に正確ではありませんいくつかの情報を提供します。 Wi-Fiは常に私に十分な前哨を与えるので、私は場所をオンにするのと同じ方法でユーザーにWi-Fiをオンにするように頼みたい。私はそれをオンにしたくない、私はそれについて通知され、手動で有効にしたい。
ユーザーにWiFiメニューを送信する意図はありますか?設定の完全なリストについては
startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
:
あなたもこれを試すことができます[Wi-Fiを有効にする](http://stackoverflow.com/a/5674685/1083388) –