Java Code Examples for no.nordicsemi.android.log.Logger#d()
The following examples show how to use
no.nordicsemi.android.log.Logger#d() .
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: BleProfileServiceReadyActivity.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 6 votes |
@SuppressWarnings("unchecked") @Override public void onServiceConnected(final ComponentName name, final IBinder service) { final E bleService = BleProfileServiceReadyActivity.this.service = (E) service; bluetoothDevice = bleService.getBluetoothDevice(); logSession = bleService.getLogSession(); Logger.d(logSession, "Activity bound to the service"); onServiceBound(bleService); // Update UI deviceName = bleService.getDeviceName(); deviceNameView.setText(deviceName); connectButton.setText(R.string.action_disconnect); // And notify user if device is connected if (bleService.isConnected()) { onDeviceConnected(bluetoothDevice); } else { // If the device is not connected it means that either it is still connecting, // or the link was lost and service is trying to connect to it (autoConnect=true). onDeviceConnecting(bluetoothDevice); } }
Example 2
Source File: BleProfileServiceReadyActivity.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void onServiceDisconnected(final ComponentName name) { // Note: this method is called only when the service is killed by the system, // not when it stops itself or is stopped by the activity. // It will be called only when there is critically low memory, in practice never // when the activity is in foreground. Logger.d(logSession, "Activity disconnected from the service"); deviceNameView.setText(getDefaultDeviceName()); connectButton.setText(R.string.action_connect); service = null; deviceName = null; bluetoothDevice = null; logSession = null; onServiceUnbound(); }
Example 3
Source File: BleProfileServiceReadyActivity.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override protected void onStop() { super.onStop(); try { // We don't want to perform some operations (e.g. disable Battery Level notifications) // in the service if we are just rotating the screen. However, when the activity will // disappear, we may want to disable some device features to reduce the battery // consumption. if (service != null) service.setActivityIsChangingConfiguration(isChangingConfigurations()); unbindService(serviceConnection); service = null; Logger.d(logSession, "Activity unbound from the service"); onServiceUnbound(); deviceName = null; bluetoothDevice = null; logSession = null; } catch (final IllegalArgumentException e) { // do nothing, we were not connected to the sensor } }
Example 4
Source File: BleProfileServiceReadyActivity.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void onDeviceSelected(@NonNull final BluetoothDevice device, final String name) { final int titleId = getLoggerProfileTitle(); if (titleId > 0) { logSession = Logger.newSession(getApplicationContext(), getString(titleId), device.getAddress(), name); // If nRF Logger is not installed we may want to use local logger if (logSession == null && getLocalAuthorityLogger() != null) { logSession = LocalLogSession.newSession(getApplicationContext(), getLocalAuthorityLogger(), device.getAddress(), name); } } bluetoothDevice = device; deviceName = name; // The device may not be in the range but the service will try to connect to it if it reach it Logger.d(logSession, "Creating service..."); final Intent service = new Intent(this, getServiceClass()); service.putExtra(BleProfileService.EXTRA_DEVICE_ADDRESS, device.getAddress()); service.putExtra(BleProfileService.EXTRA_DEVICE_NAME, name); if (logSession != null) service.putExtra(BleProfileService.EXTRA_LOG_URI, logSession.getSessionUri()); startService(service); Logger.d(logSession, "Binding to the service..."); bindService(service, serviceConnection, 0); }
Example 5
Source File: BleProfileServiceReadyActivity.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void onDeviceDisconnected(@NonNull final BluetoothDevice device) { connectButton.setText(R.string.action_connect); deviceNameView.setText(getDefaultDeviceName()); try { Logger.d(logSession, "Unbinding from the service..."); unbindService(serviceConnection); service = null; Logger.d(logSession, "Activity unbound from the service"); onServiceUnbound(); deviceName = null; bluetoothDevice = null; logSession = null; } catch (final IllegalArgumentException e) { // do nothing. This should never happen but does... } }