本文整理汇总了Java中com.eveningoutpost.dexdrip.utils.LocationHelper类的典型用法代码示例。如果您正苦于以下问题:Java LocationHelper类的具体用法?Java LocationHelper怎么用?Java LocationHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LocationHelper类属于com.eveningoutpost.dexdrip.utils包,在下文中一共展示了LocationHelper类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addListenerOnButton
import com.eveningoutpost.dexdrip.utils.LocationHelper; //导入依赖的package包/类
public void addListenerOnButton() {
button = (Button) findViewById(R.id.startNewSensor);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && DexCollectionType.hasBluetooth()) {
if (!LocationHelper.locationPermission(StartNewSensor.this)) {
JoH.show_ok_dialog(activity, "Please Allow Permission", "Location permission needed to use Bluetooth!", new Runnable() {
@Override
public void run() {
activity.requestPermissions(new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, 0);
}
});
} else {
sensorButtonClick();
}
} else {
sensorButtonClick();
}
}
});
}
示例2: addListenerOnButton
import com.eveningoutpost.dexdrip.utils.LocationHelper; //导入依赖的package包/类
public void addListenerOnButton() {
button = (Button)findViewById(R.id.startNewSensor);
linkPickers = (CheckBox)findViewById(R.id.startSensorLinkPickers);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
linkPickers.setChecked(prefs.getBoolean("start_sensor_link_pickers", false));
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (!LocationHelper.locationPermission(StartNewSensor.this)) {
requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 0);
} else {
sensorButtonClick();
}
} else {
sensorButtonClick();
}
}
});
}
示例3: onCreate
import com.eveningoutpost.dexdrip.utils.LocationHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.OldAppTheme); // or null actionbar
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bluetooth_scan);
final BluetoothManager bluetooth_manager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
bluetooth_adapter = bluetooth_manager.getAdapter();
mHandler = new Handler();
if (bluetooth_adapter == null) {
Toast.makeText(this, R.string.error_bluetooth_not_supported, Toast.LENGTH_LONG).show();
finish();
return;
}
if (!bluetooth_manager.getAdapter().isEnabled()) {
if (Pref.getBoolean("automatically_turn_bluetooth_on",true)) {
JoH.setBluetoothEnabled(getApplicationContext(),true);
Toast.makeText(this, "Trying to turn Bluetooth on", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(this, "Please turn Bluetooth on!", Toast.LENGTH_LONG).show();
}
} else {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
Toast.makeText(this, "The android version of this device is not compatible with Bluetooth Low Energy", Toast.LENGTH_LONG).show();
}
}
// Will request that GPS be enabled for devices running Marshmallow or newer.
LocationHelper.requestLocationForBluetooth(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
initializeScannerCallback();
mLeDeviceListAdapter = new LeDeviceListAdapter();
setListAdapter(mLeDeviceListAdapter);
}
示例4: onCreate
import com.eveningoutpost.dexdrip.utils.LocationHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bluetooth_scan);
final BluetoothManager bluetooth_manager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
bluetooth_adapter = bluetooth_manager.getAdapter();
mHandler = new Handler();
if (bluetooth_adapter == null) {
Toast.makeText(this, R.string.error_bluetooth_not_supported, Toast.LENGTH_LONG).show();
finish();
return;
}
if (!bluetooth_manager.getAdapter().isEnabled()) {
Toast.makeText(this, "Bluetooth is turned off on this device currently", Toast.LENGTH_LONG).show();
} else {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
Toast.makeText(this, "The android version of this device is not compatible with Bluetooth Low Energy", Toast.LENGTH_LONG).show();
}
}
// Will request that GPS be enabled for devices running Marshmallow or newer.
LocationHelper.requestLocationForBluetooth(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
initializeScannerCallback();
mLeDeviceListAdapter = new LeDeviceListAdapter();
setListAdapter(mLeDeviceListAdapter);
}