Android App priority for a sensor - event-listener

I'm not English so excuse me if I'll do some language mistake.. My question is: if two different apps request at the same time the control of a sensor (with a EventListener,) such as the proximity sensor, which one have the priority to control that sensor?
I try to be more more specific.. I would like to create an app that always control the proximity sensor and when it's covered do an action. Now the problem: some application , also some pre-installed app as some Samsung app, when opened control the proximity sensor to do something when it's covered, just like my app: what app have the priority when the proximity sensor is covered?

Related

Using Beacon as a locating device in retail

how to detect beacon signal and do we need to make any app to manage it or any predefined app or site is available?
I want to know how Beacon works and which Beacon is suitable for retail.
You need a mobile phone with Bluetooth 4.0 to detect beacons. They emit a BLE signal which is a little different from the normal Bluetooth signal. There are many generic apps in the play store and maybe in the app store to detect them.
But if you are looking for real functionality related to that, then you'll be needing the retail store-specific mobile app so that it can show you relevant updates in the app.

Can I detect proximity between two beacons?

I'm currently study BLE Beacon. I know that with Google Beacon API and its app, it is possible to know when the beacon communicates with my mobile phone, so I can design different notifications based on the proximity. But in my case, I need to know the proximity between a wearable beacon to a stable beacon. Is that possible at all?
Two challenges to doing this:
Google Beacon APIs do not provide proximity information beyond a beacon being visible at all (regardless of distance) to a mobile phone.
Beacons are generally speaking one way transmitters. You cannot use a beacon to listen for another beacon.
To make something like this work you need one of the two devices (either fixed or mobile) to be a beacon scanner, not a beacon. You could make a beacon scanner out of a fixed Raspberry Pi 3 which would detect the beacon wearables and calculate the distance to them. This is an approach I have helped multiple clients implement.

iOS 9.2.1: iBeacon region monitoring bug

I deployed the same iBeacon region monitoring code in 7 devices. One of them, iPhone 6 running iOS 9.2.1, is regularly failing to detect beacon states (inside, outside, etc..).
I tried with and without SIM card and when the SIM card is inserted it gives better results. However, when compared to an iPhone 6 running iOS 9.2.3 and one running iOS 9.2.1 it gives worst results (the latter two iPhone's always detect the region).
Have you experienced the same in this version of iOS (iOS 9.2.1)?
Is this an known official Apple bug?
My theory behind this:
iBeacon region monitoring uses iPhone location, iPhone location can be
improved using Wi-Fi and phone signal and possibly also accelerometer
and gyroscope data.
iOS could be using these in combination withe the Bluetooth data to
"tune" the beacon ranging thread (in other words if a significant
location happens then the background monitoring frequency will be
increased). Hence if this tuning is depending on the SIM card
information there could be a version of iOS where they put a stronger
dependency on the SIM card presence leading to what I am observing.

Android sensor listening when app in background

Is it possible to track motion sensor events on Android continuously, even if the app is not in foreground?
If yes - what's the drain on battery?
A client asked if it would be possible to write an app that would initiate an action if the person "falls" - which basically means continuously listening to the motion sensor for rapid movement.
First, you can definitely monitor the sensors in the background. You need to use a service for that type of application. Here is an example of someone creating a barometer data logger. There's not really any reason you couldn't use different sensors.
Second, as far as I'm aware, running the sensors continuously like that would drain the battery quickly. This presentation suggests that depending on your sampling speed, you could burn through about 4% of the battery per hour on the sensor use.
Lastly, you can definitely wake the phone and take action upon an event received by that service. See this question.

Make a simple iphone app that can connect another bluetooth device

I know some basic about iOS programming, now i want to connect my app to another non iphone device e.g. connecting to a bluetooth device that can control a light bulb on and off, or control any furnitures.
My question is, besides iOS xcode, what kind of program i need to learn in order to achieve my goal?
Is there any sources that i can learn from it?
For Bluetooth Low Energy devices, you can use the CoreBluetooth framework to access them.
For Classic Bluetooth devices or accessories that make use of the Dock connector, the protocols are not open, and joining the Made for iPhone (MFi) program is required. I do not suggest this for beginning.
My suggestion is to buy for example a Polar Heart Rate Belt that supports Bluetooth Low Energy. These use standard protocols. Sample code is available from Apple that shows how to read out the heart rate from such a device.
As soon as you have mastered the heart rate monitor example, a next step would be to acquire a programmable Bluetooth Low Energy chip (however, often, the development tools for those are rather expensive!). Those chips can be programmed with custom profiles to listen for Bluetooth Low Energy connections and then performing defined operations (lighting a LED) when writes to characteristics occur. So, you are not limited to heart rate monitors and similar devices.
Keywords that you can search for: GATT protocol, Bluetooth Low Energy, CoreBluetooth.
I know that it's a steep learning curve for beginners, but the area is pretty new. However, I can assure you that it's a fun area.
I also think that you should look in to embedded C programming for the slave device (Heart Rate Monitor)
You could get a tod Smart Beacon Development kit for ~$150 and then use BGScript to code the firmware to control the BLE device from your phone or pc. todhq.com for more info.