This functionality has all been moved to the open source Android Beacon Library which will:
-
wake up/launch your app when iBeacons matching a desired pattern are detected
-
perform beacon scanning in the background even if the user has not launched your app yet
-
reduce the scan rate automatically in the background to 30 seconds every five minutes to save battery. (Timing configurable.)
Code examples are show here
If your BLE device is not a beacon you could still use this library to accomplish this by having your sensor also transmit as a beacon then after it is detected connect to the main service.