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


Java Logger.openSession方法代码示例

本文整理汇总了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;
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:26,代码来源:BleProfileService.java

示例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;
}
 
开发者ID:NordicSemiconductor,项目名称:Android-nRF-Toolbox,代码行数:22,代码来源:BleProfileService.java

示例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();

}
 
开发者ID:linkezhi,项目名称:Android-nRF-Toolbox-master,代码行数:24,代码来源:BleProfileServiceReadyFragment.java

示例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());
}
 
开发者ID:frostmournex,项目名称:nRFToolbox,代码行数:26,代码来源:BleProfileServiceReadyActivity.java

示例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());
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:31,代码来源:BleProfileServiceReadyActivity.java

示例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());
}
 
开发者ID:NordicSemiconductor,项目名称:Android-nRF-Toolbox,代码行数:31,代码来源:BleProfileServiceReadyActivity.java


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