當前位置: 首頁>>代碼示例>>Java>>正文


Java Settings.ACTION_LOCATION_SOURCE_SETTINGS屬性代碼示例

本文整理匯總了Java中android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS屬性的典型用法代碼示例。如果您正苦於以下問題:Java Settings.ACTION_LOCATION_SOURCE_SETTINGS屬性的具體用法?Java Settings.ACTION_LOCATION_SOURCE_SETTINGS怎麽用?Java Settings.ACTION_LOCATION_SOURCE_SETTINGS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.provider.Settings的用法示例。


在下文中一共展示了Settings.ACTION_LOCATION_SOURCE_SETTINGS屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sendNotification

private void sendNotification(String s) {
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);
    mBuilder.setSmallIcon(R.drawable.logo);
    mBuilder.setContentTitle("Event-Me");
    mBuilder.setContentText(s);

    Intent i = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    i.putExtra("from","notif");
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, i,
            PendingIntent.FLAG_UPDATE_CURRENT);
    mBuilder.setContentIntent(contentIntent);

    NotificationManager mNotificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
            mNotificationManager.notify(001, mBuilder.build());
}
 
開發者ID:picopalette,項目名稱:event-me,代碼行數:17,代碼來源:LocationData.java

示例2: onConnected

@SuppressWarnings("MissingPermission")
@Override
public void onConnected(@Nullable Bundle bundle) {
    mLocationRequest = LocationRequest.create();
    mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
    mLocationRequest.setInterval(1000); // Intervals millis
    mLocationRequest.setFastestInterval(500); //If avaible sooner

    if (!isPermissionGranted(this, Manifest.permission.ACCESS_FINE_LOCATION)) {
        return;
    }

    if (!checkGPSisOpen()) {
        Toast.makeText(this, "Enable location services for accurate data.", Toast.LENGTH_SHORT)
                .show();
        Intent viewIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
        startActivity(viewIntent);
    } else {
        LocationServices.FusedLocationApi
                .requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);

        mLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);

        getCoords(LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient));
    }
}
 
開發者ID:PalisadoesFoundation,項目名稱:do-road,代碼行數:26,代碼來源:MainActivity.java

示例3: startMap

private void startMap(){
    if( isLocationEnable() ){
        mapFragment.getMapAsync( this );
    }else{
        Intent myIntent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS );
        startActivity( myIntent );
    }
}
 
開發者ID:TheKhaeng,項目名稱:nongbeer-mvp-android-demo,代碼行數:8,代碼來源:MapActivity.java

示例4: startGPSSetting

/**
 * 打開gps設置
 */
public static void startGPSSetting() {
    // 轉到手機設置界麵,用戶設置GPS
    Intent intent = new Intent(
            Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    UtilManager.getContext().startActivity(intent);
}
 
開發者ID:sundevin,項目名稱:utilsLibrary,代碼行數:10,代碼來源:SystemIntent.java

示例5: onGPS

/**
 * Opens GPS settings to allow user turn GPS on.
 */

@Override
public void onGPS() {
    Intent gpsIntent = new Intent(
            Settings.ACTION_LOCATION_SOURCE_SETTINGS
    );
    startActivityForResult(gpsIntent, gpsReqCode);
}
 
開發者ID:aumarbello,項目名稱:WalkGraph,代碼行數:11,代碼來源:MapFragmentImpl.java

示例6: onCreate

/**
 * On create, check if the user has location enabled.
 * Obtain the MapFragment and get notified when the map is ready to be used.
 * @param savedInstanceState
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);

    // Obtain the MapFragment and get notified when the map is ready to be used.
    MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);

    options = (Button) findViewById(R.id.map_options);
    mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);

    try {
        toDisplayAL = (ArrayList<Markers>) getIntent().getExtras().getSerializable("toDisplay");
    } catch (Exception e) {
        // no events to display
    }

    // If GPS (location) is not enabled, User is sent to the settings to turn it on!
    service = (LocationManager) getSystemService(LOCATION_SERVICE);
    boolean enabled = service.isProviderEnabled(LocationManager.GPS_PROVIDER);
    if (!enabled) {
        Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
        startActivity(intent);
    } else {
        getDeviceLoc();
    }

    options.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            finish();
        }
    });
}
 
開發者ID:CMPUT301F17T23,項目名稱:routineKeen,代碼行數:40,代碼來源:MapsActivity.java

示例7: openGpsSettings

/**
 * 打開Gps設置界麵
 */
public static void openGpsSettings() {
    Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    Utils.getContext().startActivity(intent);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:LocationUtils.java

示例8: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
        Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_LONG).show();
        mBleSupported = false;
    }

    mBluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
    mBtAdapter = mBluetoothManager.getAdapter();

    if (mBtAdapter == null || !mBtAdapter.isEnabled()) {
        Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
        startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (this.checkCallingOrSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
            final AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle("This app needs location access");
            builder.setMessage("Please grant location access so this app can detect beacons.");
            builder.setPositiveButton(android.R.string.ok, null);
            builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialog) {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                        requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, PERMISSION_REQUEST_COARSE_LOCATION);
                    }
                }
            });
            builder.show();
        } else {
            if(isLocationProviderEnabled((LocationManager) getSystemService(Context.LOCATION_SERVICE))) {
                initBluManager();
            }else{
                Intent myIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                startActivityForResult(myIntent, REQUEST_ENABLE_LOCATION);
            }
        }
    } else if (savedInstanceState == null && mBleSupported) {
        initBluManager();
    } else {
        //Error TODO
    }
}
 
開發者ID:UDOOboard,項目名稱:UDOOBluLib-android,代碼行數:46,代碼來源:UdooBluAppCompatActivity.java

示例9: goToGpsSettings

/**
 * Redirect user to enable GPS
 */
public void goToGpsSettings() {
    Intent callGPSSettingIntent = new Intent(
            Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    mContext.startActivity(callGPSSettingIntent);
}
 
開發者ID:SoftprodigyIndia,項目名稱:AndroidAppBoilerplate,代碼行數:8,代碼來源:AppUtils.java

示例10: onProviderDisabled

@Override
public void onProviderDisabled(String provider) {
    Intent i = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    startActivity(i);
}
 
開發者ID:mezau532,項目名稱:smart_commuter,代碼行數:5,代碼來源:GetCurrentLocation.java

示例11: onSelected

@Override
public void onSelected(int buttonIndex) {
	Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
	mActivity.startActivity(intent);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:5,代碼來源:GpsSettingHandler.java

示例12: requestLocationEnabling

public static void requestLocationEnabling(@NonNull Activity activity) {
    Log.d(TAG, "Requesting location enabling");
    Intent locationSettings = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    activity.startActivity(locationSettings);
}
 
開發者ID:neXenio,項目名稱:BLE-Indoor-Positioning,代碼行數:5,代碼來源:AndroidLocationProvider.java

示例13: onProviderDisabled

@Override
    public void onProviderDisabled(String provider) {
        // TODO Auto-generated method stub
        /*************************************Notify***************************************/

        NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this);

        Intent resultIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
        TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
        stackBuilder.addParentStack(Location_event.class);

        stackBuilder.addNextIntent(resultIntent);
        PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(02,PendingIntent.FLAG_UPDATE_CURRENT);

        mBuilder.setContentIntent(resultPendingIntent);
        mBuilder.setSmallIcon(R.drawable.findx_logo);
        mBuilder.setContentTitle("digiPune Disconnected");
        mBuilder.setContentText("Please turn on Location");
        mBuilder.addAction(R.drawable.ic_action_settings, "Settings", resultPendingIntent);


// Adds the Intent that starts the Activity to the top of the stack


        NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

// notificationID allows you to update the notification later on.
        mNotificationManager.notify(0, mBuilder.build());

        /*************************************Notify***************************************/




    }
 
開發者ID:SkylineLabs,項目名稱:FindX,代碼行數:35,代碼來源:digiPune.java

示例14: startLocationSettings

/**
 * 或要去開啟結果,必須實現startActivityForResult
 *
 * @param context
 * @param requestCode
 */
public static void startLocationSettings(Activity context, int requestCode) {
    Intent enableLocationIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    context.startActivityForResult(enableLocationIntent, requestCode);
}
 
開發者ID:Twelvelines,項目名稱:AndroidMuseumBleManager,代碼行數:10,代碼來源:IntentUtils.java

示例15: openGps

/**
 * 打開 Gps 係統設置頁麵
 *
 * @param activity
 * @param requestCode 請傳入 {@link BluetoothUtils#REQUEST_CODE_GPS} 常量
 */
public static void openGps(Activity activity, int requestCode) {
    Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    activity.startActivityForResult(intent, requestCode);
}
 
開發者ID:RockyQu,項目名稱:BluetoothKit,代碼行數:10,代碼來源:BluetoothUtils.java


注:本文中的android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。