0

したがって、GPSが有効になっていない場合にAndroidでGPSウィンドウを起動する方法を理解していますが、私の場合、コードが起動していません(クラスの他のすべてのgps機能が完全に機能しているにもかかわらず)私は次のことを行っています:

    // CHECK GPS!
    gps = new gpstracker(MainActivity.this);
    if (gps.canGetLocation()) {
    } else {
        final ComponentName toLaunch = new ComponentName("com.android.settings","com.android.settings.SecuritySettings");
        final Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
        startActivity(intent);

            }

if ステートメントの外側で次を実行すると、正常に機能しました。

        final ComponentName toLaunch = new ComponentName("com.android.settings","com.android.settings.SecuritySettings");
        final Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
        startActivity(intent);

gps が場所を取得できないことを知っているのに、ステートメントの else 部分をトリガーできない理由について、私は途方に暮れています。使用している GPS クラスを添付しました。

gps クラス https://gist.github.com/4416280

4

0 に答える 0