Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to detect Android devices laying side by side

I am developing an Android application that requires devices to be laid side by side and/or above and below each other.

I know I can use the Nearby API to detect devices "Nearby" however I need something a little more "Finer Grained".

My app needs to be able to identify a device laying either on the left side, above, right side or below. While all devices are laying flat on a table (for instance).

I can find nothing on the web that describes this use case.

Is it possible?

UPDATE

My use case is that I want Android devices to be able to detect any number of "Other Devices" laying either to their left or right. The devices will be laid out horizontally with a "small" gap between each one.

In the same way that you might layout children's lettered blocks to spell out a word or phrase, or numbered blocks to make a sum.

not only should the line of devices be able to detect their immediate neighbours to their left and right the two devices at either end should be able to detect they they are the start and end (reading left to right) of the line.

like image 481
Hector Avatar asked Jul 12 '17 10:07

Hector


2 Answers

Using proximity sensors is a likely way to solve your question. TYPE_PROXIMITY will gives the distance from a near by object. TYPE_MAGNETIC_FIELD gives the geomagnetic field strength on x/y/z.

For more read Position Sensors.

like image 81
RonTLV Avatar answered Sep 22 '22 21:09

RonTLV


  1. Making your own Mock GPS (Local PS to be exact). I don't have a link for this but its definitely possible. Check out how GPS works to get an idea. Wifi and Bluetooth are signals. but you know what else is a signal?

A: SOUND

make each phone make a large beep in turn and measure audio strength using receivers. This might work better than wifi/bluetooth. once you measure relative distances between every pair of phones, it only takes a good algorithm to find relative positions

  1. A Possible Alternative Solution : use image processing. Get something like OpenCV for Android and setup one phone as a master. This will work only for a 2D Layout.

  2. Another "idea" - use the cameras. Stick A board on top of your surface with 4 QR codes in each corner. (This will help identify the edges and orientation of your phone). If you're looking for a 3D layout and the phones have sufficient in-between space, you could stick a QR behind every phone and show a QR on the screen of every phone.

All of these are solutions. Maybe you can use individual ones. Maybe you can use a combination. who knows.

like image 33
ColonD Avatar answered Sep 18 '22 21:09

ColonD