/** * OnCreate: Activity is created. * * @param savedInstanceState */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(TAG, "onCreate:+"); mBleScanSm = BleScanSm.makeBleSm("mBleScanSm"); mSm1 = BleSm1.makeBleSm1("mSm1"); mSm1.sendMessage(BleSm1.ON_CREATE, mBleScanSm); mHasFeatureBle = getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE); Log.i(TAG, "onCreate: mHasFeatureBle=" + mHasFeatureBle); if (mHasFeatureBle) { Log.i(TAG, "onCreate: has Bluetooth LE"); mBtLeSupported = true; mBtManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE); mBtAdapter = mBtManager.getAdapter(); } else { Log.i(TAG, "onCreate: NO Bluetooth LE"); showFatalToast("Device has no Bluetooth LE/smart feature"); } setContentView(R.layout.activity_main); Log.i(TAG, "onCreate:-"); }
@Override protected void onPause() { super.onPause(); Log.i(TAG, "onPause:+"); if (mMyScanCallBack != null && mBtScanner != null) { Log.i(TAG, "onPause: stopScan"); // BUG: For somereason this didn't stop the scanning!! mBtScanner.stopScan(mMyScanCallBack); } Log.i(TAG, "mSm1: dump"); Log.i(TAG, mSm1.toString()); Log.i(TAG, "mBleScanSm: dump"); Log.i(TAG, mBleScanSm.toString()); Log.i(TAG, "onPause:-"); }