当前位置: 首页>>代码示例>>Java>>正文


Java LocationHelper类代码示例

本文整理汇总了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();
            }
        }
    });
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:24,代码来源:StartNewSensor.java

示例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();
            }
        }
    });
}
 
开发者ID:StephenBlackWasAlreadyTaken,项目名称:xDrip-Experimental,代码行数:21,代码来源:StartNewSensor.java

示例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);
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:37,代码来源:BluetoothScan.java

示例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);
}
 
开发者ID:StephenBlackWasAlreadyTaken,项目名称:xDrip-Experimental,代码行数:30,代码来源:BluetoothScan.java


注:本文中的com.eveningoutpost.dexdrip.utils.LocationHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。