Android: Connect two phones wirelessly? - android

I'm interested in fleshing out an idea for a Android phone app, and I'm wondering if this is possible. So I would have the app running in the background on Phone A, then when it finds another Android phone B, it saves certain information like time, GPS location, just state variables.
But if the other phone is also running the same app, the two phones connect and share trivial non-private information.
Hypothetically, would this be possible? Would I go through a local ad-hoc Wi-Fi connection, or constantly broadcast Bluetooth?

If both people have the same app, you could do it in a round about way. If two people installed the app on their phone and agreed to have their gps coordinates shared, you could upload both sets of gps coordinates to a server as the people move around. The server could then compare which people are close to each other. When the user wants to share information with another user, the phone just needs to ask the server who is in their vicinity and sharing could be done over the internet. This is essentially how Bump works. Bumping two phones together triggers a call to the server to see who else is bumping in that vicinity at the same time. After phones close by are discovered, you might be able to trigger bluetooth pairing and sharing if you don't want to share over the internet.

Bluetooth is the easiest way for two phones to communicate directly with each other. However, both phones would have to be paired through the Settings->Wireless->Bluetooth menu. You would experience better range and speed with WiFi, but this requires a router as far as I know.

I found out how this can be done, use the viewranger app on both phones, create a user and log into the app on both phones. I set this up with myself as the user. Then the second phone (the one with broken gps) is used to track the user who is in my back pocket.
The user in both cases is me.
The problem with this is that a phone signal is required.

Related

How can I bridge phone calls to VoIP?

I want to have one stationary device like an android phone that can use a standard local SIM card and forward all calls to a second device over some kind of VoIP protocol. When someone calls the phone number of the stationary device, I want my second device to ring and handle the call through something like linphone, element, or whatever. Ideally, it should be possible from the second device to initiate a call from the stationary device's phone number as well. Bridging SMS too would be nice, but I already have a solution for this on android.
There are many use cases like
when traveling abroad, being able to bring the latter device and receive/make calls via the stationary device at home
forwarding multiple phone numbers to a single device and e.g. switching off the work number when away from work
having privacy when the location of SIM cards is logged, by making calls over wifi from somewhere else than the stationary device
when traveling somewhere with bad mobile coverage but available wifi, without having to think about how the second device handles it
Are there any existing projects for doing this?
If not, then what would be necessary to make something myself? Is the best solution something like connected an android device by bluetooth to something running asterisk like was discussed here? Or has something changed in the past 11 years, maybe the existence of some working linux phones makes this possible on a dedicated purism or pinephone device?
I think you can achieve this with Brekeke SIP Server. I am using their solution to achieve something similar to what you want to do.
there are multiple ways to achieve it technically, but the most practical solution to your use case will be to use a VOIP Gateway device.
Actually we can not use a mobile phone as gateway between SIM and VOIP calls.
so you can buy a voip gateway example GOIP (single SIM) and put your sim, connect to your home internet and configure. your phones softphone (eg linphone) will be able to directly register on it and you will be able to make/receive calls and sms.
there will be a new problem as mobile OS platforms are more and more restrictive about power, your sip client will not be able to receive calls while in background for that you will need push, so you can use twillio's mobile sdk to make a client that works fine then forward your calls to twillio from gateway. since there is no number or telecom services involved, cost on twillio should be minimal.
A more common way to do this is with an operator service, rather than implementing it yourself.
The operator is able to see the routing to your number and simultaneously call multiple numbers you have set up. Different operators will have different names and details so you would need to speak to your local operator.
For example BT in the UK (who I have no affiliation to - just an example) provide a service called 'Follow ME': https://support.ringcentral.co.uk/s/article/9010?language=en_GB
If you do want to do it yourself than an open source PBC like Asterisk is indeed a good starting point.

Is communication with nearby (bluetooth?) devices (phones and tablets) possible considering the fact that they all share a same application?

Consider an application that has for example application called "Covid detection". This application has a flag whether or not the owner of the device is covid infected at the moment. The user can change this. Now, let's assume a group of people having this same application.
My question is - is it possible for all devices to perform a scan every once a while to detect whether somebody in their close range was covid infected and send them a warning?
In my mind, the best possible scenario is to simply send a data over bluetooth everytime a bluetooth scan is performed, whitelisting the application as an auto-pair somehow (don't know if it's possible) and sharing user data (covid sick flag). However it seems like this is not possible, and instead the other way would be to perform the scan, save all MAC addresses of nearby devices and once internet connection is available, check the MAC addresses server-side for covid possibility.
Is this possible? Are there other ways?

Is it possible view the nearby devices?

I'm trying to make a app for report the human interaction because the virus, I just want to know if it's possible for follow a way, I know that exist google nearby, but that requires that both devices has the same app installed and it's the same with the bluetooth or ble, so what others tools could be usefull for make my app? Thanks.
It depends on your approach but ble has the functionality to scan for discover able advertisement from other devices.
This means you can see and store another devices address(ble) to a list / database. The beauty of this is ble only works well within a short range distance though you can filter by distance crudely by the RSSI. The RSSI is received upon scanning it is the received power from another device.
So for a contract tracing app you will need to develop a system which advertises a ble packet and along with the app scan for ble packets.
Then if you find via your scan another device, you add it to your database.
Next you need to check your database "for the virus" this means looking up a backend system where you store the ble addresses of people with the virus. Then the user checks the database with their list of addresses, if there is a match of addresses, then you have come into contact with the virus and should get treatment / self isolate. Just what ever your geographical location laws are.
So simply put you need:
App for both phone
Back end database
Database on each phone of addresses found
Ability to send out address via an advert(beacon)
Scanning of beacons
Checking database(backend for virus)
Uploading to database(Stay you have it, don't have it or are cured)
Hope this helps.

Instantly send signal to a group of mobile phones within 10 m

This question follows on from Unity3D -- Send message to other mobile phones in the same vicinity
However, I made mistake of restricting to Unity3D.
So I would like to re-ask the question without that constraint.
Let us say we have 20 mobile phone users in a cave (so no Wi-Fi networks / isGPS)
One user hits a button, and every other user's screen flashes, (within a few milliseconds)
How to accomplish this?
What if everyone is using an iPhone?
What if there is a mix of iPhone and android users?
Finally, is there any solution that would cover a wider range of phones?
You should have some network so that mobiles can share some data. Bluetooth can have maximum of 10 m distance coverage (depends upon devices though). Since, all mobile are running same app they should be linked to a network and communicate. Please Check:
http://developer.android.com/samples/BluetoothLeGatt/index.html
You can create one device as server and communicate among other devices.
https://github.com/polyclef/BluetoothChatMulti
If you have installed the app on all of the devices then in all probability yes, if the device supports push (pretty much any smartphone) then you can use the push service to synchronize the devices based on geofencing (ie, 10m from my location), there are some other discovery routes you could try to (without using the B word) pinging other devices
the app would need to be able to provide some sort of server service if it was to create its own private network based on the IP addresses of the devices it found nearby, as those devices would have to connect to that phone acting as a server. the network interface shouldn't be important, but connecting the satellite devices to the server should be. You could try doing it based on which device can provide data services, aka hotspot. You can easily connect devices to networks programmatically.
at that point your faced with the classic client server problem. There is going to be a huge amount of work to get devices configured, network creation, client server infrastructure if it has to be done without data, packet optimization. Very expensive and very high risk depending on how many restrictions there are.
Search for How to make a html5 group chat and then build on that example.
Possibly send commands to the chat delimited by a / character where a javascript could then execute the command.
Good Luck with your design.
Danny117

Use Android GPS to detect and connect with other phones

So I asked something similar yesterday and did receive an answer to my question, however I don't really think I asked it correctly and therefore didn't receive the exact information I needed.
I'm in search of an API, some open source code, or even just a way that someone else has achieved this on the Android. I'm making an app that needs to find all other Android devices within a specified radius. For example, when you open your Android Google Maps App, and you search for say "Restaurants [ZipCode]", it uses a radius modified from your zip code and finds all of those places. The GPS gets YOUR location, and maps uses that information to find restaurants within an address close to that passed in location.
Instead, I want to be able to use the GPS to find my location (as it can now easily), but instead of finding things on a map (which is already built in), I want to be able to find other GPS enabled Android phones. I get that they will have to be broadcasting their GPS signal at the same time as well (since they don't have their data stored with some sort of central database as a restaurant would). However, I don't just want to FIND these phones, I want to send/receive data from these phones (with correct permissions obviously).
Now, I've found things like the Bump API. However, BUMP uses the phones sensors to spark this search. So basically, if you "bump" your phone with another and have the app running, it will THEN go ahead and use GPS to find the location of the other phone you just bumped with and exchange data between them. This is like EXACTLY what I want to do however in their API, they do not provide the functionality to just say, "Hey, give me all phones within a mile from me."
I've also found API's that can do exactly what I need but they have to be on the same Bluetooth range or on the same Wi-Fi network, which doesn't suit what I need at all.
Do you guys know of anything that can fit exactly what I need that already exists? Or a way to maybe modify Bump API (if you've done it), to not have to use the phone sensors and find phone information directly through GPS for phones around you? Or is there something that exists over a 3g/4g network instead of only wi-fi/Bluetooth?
Thanks guys.
Instead of frequently posting locations to an external server, couldn't the GPS realize other things broadcasting a GPS signal at a very specific time and send/receive data from them?
The only things that are "broadcasting a GPS signal" are satellites.
We would like to accomplish this without the use of an external server.
You have no choice but to use an external server, whether you like it or not, both for discovery and for later communication.
Do you guys know of anything that can fit exactly what I need that already exists?
Foursquare, Google Latitude, Yahoo Fire Eagle, and so on.
To do this via GPS, you would have to have all the phones frequently posting their locations to a network server, which could then inform them of others nearby.
Needless to say this would be opt-in only!
And it may have negative consequences for battery life, unless you make it update infrequently, which may limit its usability.
The advantage of having an explicit trigger action to both phones is that they only need to query the GPS and inform the server to find each other by location when they've both been triggered.
You would probably have to author your own application - then you could do this server-side and push things. If you're trying to push data to random Android phones - you're out of luck. Most people aren't going to want this, and probably aren't going to have the apps necessary to receive and understand it. With Bluetooth networking you'd need authorization, and most Androids don't have a capability to transfer random data by Bluetooth out of the box (though you certainly can get software to do it).
Honestly, malware and tracking are the reasons this really isn't possible, but even if they weren't, you would still need an application on the receiving devices that understand what you're sending them. And if you're widely spread enough, you'd probably want to send it to a server to disseminate anyway (for the transmitting phones bandwidth costs at least).
Develop a server application that your android app logs into. Send the GPS location every time the phone moves over a present distance. Either send a query request to the server to ask it if any other phones are in range, or get the server to inform the phone of a new device in range.
You may run into server scalability problems, so thats something to think about.
Also, this would be a big battery drain, and so your users may not be too keen to run it, not to mention the privacy element.
You need to rethink what you're trying to do. Android devices don't "transmit" any GPS signal, they are simply receivers, with signals from satellites. So the phone can easily get a location for itself, but the location of other devices is very, very private information. To get access to location for other phones, you either need to be on the same network as them (bluetooth, wifi), or you need them to use a server-based service to send locations to, like Google Latitude.
I'd be highly unlikely to sign up to a service like that. My location is very private, I share it with some people, but I cannot seem myself openly sharing it with an app, without a very, very good reason.
It seems to me that you need to build a server-based application, e.g. on Google App Engine, have people sign up, and agree to their location being sent to that server, so other phones running your app can access that information from the central store.
The question now has a very simple solution to it. All you have to do is set up a Geofence and monitor it for entry and exit of users. Geofence allows you to choose a geolocation and set a circle of desired radius around it. When someone enters or exits the location you can get notified and perform desired action.
Visit this link for further details on how to use this in Android.
All the comments from other folks about not being able to pick up the signal from others phones are correct. There is a completely different alternative system however in the network based location services. This is a model where you ask a carrier network for the location of a handset, which the carrier network needs to track for enhanced 911 service in the US (I'm unaware of how widely deployed this is in other areas, and how many different services you would need to use to cover other areas).
It's potentially a very expensive route however. And it won't just automatically work for all handsets, I believe the users will have to be opted into sharing location with your service. This is how services like Loopt had initially setup their location info so that it could be passively collected without negatively impacting handset battery life. There are some third party services that front for a cross-carrier service such as Location Labs:
http://locationlabs.com/
As well as third party location services like Skyhook Wireless, who might be able to get you some info of the sort (though I don't think what you're looking for maps to any of their existing APIs)

Categories

Resources