How to detect Bluetooth state change using a broadcast receiver?

AS far as permissions go, to detect the state change of bluetooth you need to add this to your AndroidManifest.xml. <uses-permission android:name=”android.permission.BLUETOOTH” /> An example receiver would look like this, you add this code to where you want to handle the broadcast, for example an activity: private final BroadcastReceiver mReceiver = new BroadcastReceiver() { public … Read more

ActivityManager: Warning: Activity not started, its current task has been brought to the front

Are you getting the warning when you start the app or when you click the button? If you run an app from eclipse without it having to recompile (ie no code changes), it doesn’t go through the uninstall-install process, it just pushes the application to the front just like you would if you resumed it … Read more

startLeScan replacement to current api

Both methodsBluetoothAdapter.startLeScan and BluetoothAdapter.stopLeScan were deprecated in Android Lollipop. As a replacement BluetoothLeScanner were introduced and acting as a scan controller. If you develop BLE-based application you should control either scan via the BluetoothAdapter (Android 4.3 and Android 4.4) or the BluetoothLeScanner. The API introduced in Android Lollipop offers much greater features in terms of … Read more

Android: BluetoothSocket receives its own output

I scoured over the Bluetooth classes sources. The workaround seems legit from the first glances. Try this first: if (delay == 0) { Log.i(“WRT”, “Written to RaspberryPi”); out.write(“Hello Raspberry. It’s me, AndroidPhone”.getBytes()); out.flush(); // <– You are not flushing delay = 100000000; } And the message sticks in you socket for you to read over … Read more

Programmatically pairing with a BLE device on Android 4.4+

I almost have it working. It pairs programmatically but I can’t get rid of the “Pairing request” notification. Some answers to this question claim to be able to hide it just after it is shown using the hidden method cancelPairingUserInput() but that doesn’t seem to work for me. Edit: Success! I eventually resorted to reading … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)