本文整理汇总了Java中no.nordicsemi.android.log.Logger.openSession方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.openSession方法的具体用法?Java Logger.openSession怎么用?Java Logger.openSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类no.nordicsemi.android.log.Logger
的用法示例。
在下文中一共展示了Logger.openSession方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onStartCommand
import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
if (intent == null || !intent.hasExtra(EXTRA_DEVICE_ADDRESS))
throw new UnsupportedOperationException("No device address at EXTRA_DEVICE_ADDRESS key");
final Uri logUri = intent.getParcelableExtra(EXTRA_LOG_URI);
mLogSession = Logger.openSession(getApplicationContext(), logUri);
mDeviceAddress = intent.getStringExtra(EXTRA_DEVICE_ADDRESS);
Logger.i(mLogSession, "Service started");
// notify user about changing the state to CONNECTING
final Intent broadcast = new Intent(BROADCAST_CONNECTION_STATE);
broadcast.putExtra(EXTRA_CONNECTION_STATE, STATE_CONNECTING);
LocalBroadcastManager.getInstance(BleProfileService.this).sendBroadcast(broadcast);
final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(BLUETOOTH_SERVICE);
final BluetoothAdapter adapter = bluetoothManager.getAdapter();
final BluetoothDevice device = adapter.getRemoteDevice(mDeviceAddress);
mDeviceName = device.getName();
onServiceStarted();
mBleManager.connect(device);
return START_REDELIVER_INTENT;
}
示例2: onStartCommand
import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
public int onStartCommand(final Intent intent, final int flags, final int startId) {
if (intent == null || !intent.hasExtra(EXTRA_DEVICE_ADDRESS))
throw new UnsupportedOperationException("No device address at EXTRA_DEVICE_ADDRESS key");
final Uri logUri = intent.getParcelableExtra(EXTRA_LOG_URI);
mLogSession = Logger.openSession(getApplicationContext(), logUri);
mDeviceName = intent.getStringExtra(EXTRA_DEVICE_NAME);
Logger.i(mLogSession, "Service started");
final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(BLUETOOTH_SERVICE);
final BluetoothAdapter adapter = bluetoothManager.getAdapter();
final String deviceAddress = intent.getStringExtra(EXTRA_DEVICE_ADDRESS);
mBluetoothDevice = adapter.getRemoteDevice(deviceAddress);
mBleManager.setLogger(mLogSession);
onServiceStarted();
mBleManager.connect(mBluetoothDevice);
return START_REDELIVER_INTENT;
}
示例3: onCreate
import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ensureBLESupported();
if (!isBLEEnabled()) {
showBLEDialog();
}
if (savedInstanceState != null) {
final Uri logUri = savedInstanceState.getParcelable(LOG_URI);
mLogSession = Logger.openSession(getActivity().getApplicationContext(), logUri);
}
onInitialize(savedInstanceState);
//放在onCreateView中执行
//TODO
//final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
//setSupportActionBar(toolbar);
//setUpView();
}
示例4: onCreate
import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
protected final void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ensureBLESupported();
if (!isBLEEnabled()) {
showBLEDialog();
}
// Restore the old log session
if (savedInstanceState != null) {
final Uri logUri = savedInstanceState.getParcelable(LOG_URI);
mLogSession = Logger.openSession(getApplicationContext(), logUri);
}
/*
* In this example we use the ProximityManager in the service. This class communicates with the service using local broadcasts. Final activity may bind
* to the Server to use its interface.
*/
onInitialize(savedInstanceState);
onCreateView(savedInstanceState);
onViewCreated(savedInstanceState);
LocalBroadcastManager.getInstance(this).registerReceiver(mCommonBroadcastReceiver, makeIntentFilter());
}
示例5: onCreate
import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
protected final void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ensureBLESupported();
if (!isBLEEnabled()) {
showBLEDialog();
}
// Restore the old log session
if (savedInstanceState != null) {
final Uri logUri = savedInstanceState.getParcelable(LOG_URI);
mLogSession = Logger.openSession(getApplicationContext(), logUri);
}
/*
* In this example we use the ProximityManager in the service. This class communicates with the service using local broadcasts. Final activity may bind
* to the Server to use its interface.
*/
onInitialize(savedInstanceState);
onCreateView(savedInstanceState);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
setSupportActionBar(toolbar);
setUpView();
onViewCreated(savedInstanceState);
LocalBroadcastManager.getInstance(this).registerReceiver(mCommonBroadcastReceiver, makeIntentFilter());
}
示例6: onCreate
import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
protected final void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ensureBLESupported();
if (!isBLEEnabled()) {
showBLEDialog();
}
// Restore the old log session
if (savedInstanceState != null) {
final Uri logUri = savedInstanceState.getParcelable(LOG_URI);
mLogSession = Logger.openSession(getApplicationContext(), logUri);
}
// In onInitialize method a final class may register local broadcast receivers that will listen for events from the service
onInitialize(savedInstanceState);
// The onCreateView class should... create the view
onCreateView(savedInstanceState);
final Toolbar toolbar = findViewById(R.id.toolbar_actionbar);
setSupportActionBar(toolbar);
// Common nRF Toolbox view references are obtained here
setUpView();
// View is ready to be used
onViewCreated(savedInstanceState);
LocalBroadcastManager.getInstance(this).registerReceiver(mCommonBroadcastReceiver, makeIntentFilter());
}