Java Code Examples for com.eveningoutpost.dexdrip.utils.LocationHelper#requestLocationForBluetooth()

The following examples show how to use com.eveningoutpost.dexdrip.utils.LocationHelper#requestLocationForBluetooth() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThinJamActivity.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = ActivityThinJamBinding.inflate(getLayoutInflater());
    binding.setVm(new ViewModel(this));
    setContentView(binding.getRoot());
    JoH.fixActionBar(this);

    scanMeister.setFilter(customFilter);
    scanMeister.allowWide().unlimitedMatches();
    scanMeister.addCallBack2(this, TAG);

    ((TextView) findViewById(R.id.tjLogText)).setMovementMethod(new ScrollingMovementMethod());

    // handle incoming extras - TODO do we need to wait for service connect?
    final Bundle bundle = getIntent().getExtras();
    processIncomingBundle(bundle);

    LocationHelper.requestLocationForBluetooth(this);
}
 
Example 2
Source File: ThinJamActivity.java    From xDrip-plus with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = ActivityThinJamBinding.inflate(getLayoutInflater());
    binding.setVm(new ViewModel(this));
    setContentView(binding.getRoot());
    JoH.fixActionBar(this);

    scanMeister.setFilter(customFilter);
    scanMeister.allowWide().unlimitedMatches();
    scanMeister.addCallBack2(this, TAG);

    ((TextView) findViewById(R.id.tjLogText)).setMovementMethod(new ScrollingMovementMethod());

    // handle incoming extras - TODO do we need to wait for service connect?
    final Bundle bundle = getIntent().getExtras();
    processIncomingBundle(bundle);

    LocationHelper.requestLocationForBluetooth(this);
}
 
Example 3
Source File: BluetoothScan.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example 4
Source File: BluetoothScan.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example 5
Source File: BluetoothScan.java    From xDrip-Experimental with GNU General Public License v3.0 5 votes vote down vote up
@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);
}