当前位置: 首页>>代码示例>>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;未经允许,请勿转载。