Android 3g wifi simultaneously - android

I am using Android studio 2 and java, and i am writing an app that i need to be connected with a piece of hardware through wifi (parrot ar drone 2) and also "trigger" some events (takeoff land etc) through 3g network. I have made a simple app using parrot sdk that do some simple things to my drone successfully . I am facing now the challenge that these simple things i want to be driven through my server (i am thinking of websockets).
So my problem is :
If my device is connected through wifi to the drone, how could i also connect to the internet in order to get "triggered" to run some commands?
I was thinking that would be great if o could connect my android device to the drone and with some way be connected to internet.
After some research i have found that may be this functionality be available to android 6 BUT i have not found any example yet.
Generally i trying to find a solution (software or hardware).
I appreciate a lot any kind of help or suggestion about my problem.
Thx in advance

I don't think it is possible to connect to 2 W-Lan hotspots simultaneously with just one chip. Where did you find that information?

You can set up your Android device as a WiFi hotspot and have your drone connect to the internet via that.
At the same time your app can connect to the drone, assuming your drone has some sort of local server like connection your app connects to.
You can check this in practice quickly by setting up a Wifi hotspot, connecting your drone and then using a ping utility on the phone to make sure you can ping the drone successfully.
If you want to connect from a remote server to the drone then you are dependent on your network allowing inbound connections, which is often not the case. A common workaround is to use some form of mobile push notifications to send a message to your app asking it to contact a server on the internet, which will then tell it what action you want to perform on the drone. In others words:
send message to server on the internet somewhere to tell drone to take off
your server triggers a push notification to the app on the phone
the app contacts the server and asks 'what is the message for me'
the server responds to the app with the 'tell drone to take off' message
the app messages the drone to tell it to take off

Related

How to make HTTP Requests over WiFi directly from Android Wear?

how can I execute HTTP requests or open a socket on Android Wear? I used to think that's impossible but the Web Browser for Android Wear app says the folloing:
"[..] works even when your phone is off if you have a smartwatch with Android Wear 5.1 and WiFi"*.
I tested it and that app CAN connect the internet when the paired phone is powered off.
Whenever I open a socket or try HTTP requests on Android Wear I always get a ConnectException saying failed to connect to http://foo.com (similar stack trace here). So I'm doing something different then that app is doing and I'd like to understand what that is.
Context: I'm working on proof-of-concept and just want to be able to execute HTTP requests and open sockets. I'd love to know if there's any way to do that. Even if it includes rooting the watch and doing some adb magic.
To clarify: I know about the Data Layer API and i'd still like to be able to just do HTTP requests and open sockets.
If your watch has Wifi and it is set up correctly, then you can make network calls on your watch when your watch is disconnected from the phone; when you connect to your phone via BT, wifi will be disabled. While it is enabled, you should be able to treat that as a usual network connectivity and make network calls. But keep in mind that if you write an app that relies on this, your app will fail to work when it gets connected to a phone so you need to handle that case and provide an alternative for your app to get the same data (i.e. using the phone's connectivity).

Android to iOS connect via WiFi or using Multipeer connectivity or using WiFi direct

So I am developing an APP and I need to connect multiple android and multiple Iphone to send text data without any internet connection or service provider data network.
So one of the phone will have to act as a server to relay information between them. But the app will have to decide which phone will be the server and if a phone that is the server leaves the conversation then another phone will pickup as the server this will all be done with some smart programming but before I get there.
I know Android WiFi direct can do a one to many connection setup which makes it easy to connect android phone and accomplish the task between android phone only. But the problems comes when I need to connect Iphone with the android phones. Since the Iphone must be able to act as a server as well.
I would like to know a few things:
Can I connect Android and Iphone via WiFi Direct?
Can I connect Android and Iphone using Multipeer connectivity feature on Iphone?
Is there anyway to create a soft access point using Iphone? I know android can do this via WiFi direct feature.
If non of these can work can you suggest something.
From the discussion here it doesn't look possible
I wonder though if both OS allow enough control over the WiFi transceiver if you couldn't just write an app that could what you are asking and just bypassing the built in software architecture all together. I would think Bluetooth would be too weak except in extremely dense device saturation environments, but just for proof of concept that could be another route to take. My guess though is that you just wouldn't get that level of control over any of the radios inside a phone through the current OS.

find all devices in a network

In my local network there are several devices (running linux, c++) and an Android Smartphone.
Now I want to find and display all devices in the network on the Android Smartphone. Later i want to pair the android smart phone with the device for communication.
What's a good way to implement this?
My first ideas are:
sending a udp broadcast from the android smartphone, and handle these requests on each device and return a udp packet with more informations about the device.
or
When a device is active it periodically sends heartbeats as broadcast which the android smartphone can detect.
i also read about upnp, but i think this is kinda overkill.
Can you give me any hints how to implement this kind of task?
ty
You may want to have a look at nmap. It is a network scanner that can look through the network and find devices on it. Parse the output from it and display on the phone.

Android server-initiated TCP connection

I am new to Android development and I would like to know if there is any way to establish a server-initiated tcp connection on an Android device.
What I'm trying to achieve is making an external server able to access data from the Android phone at any time without using a battery-draining permanent connection.
As it is not possible for the phone to do something similar to an accept() when it is on 3G, I was wondering if there might be a system of "hidden" notifications that could be used to tell the phone to connect to the server.
Another option would be for the phone to try a connection every X seconds but I don't like the idea, and I'd rather have the connection to be created as soon as it's needed.
Are there any 'clean' solutions to do this?
You may want to have a look at the Google Cloud Messaging for Android.

Is it possible to exchange messages between 2 android devices through wifi?

I am currently working on the creation of an application for mobile devices with Android which should be capable of sending and receiving messages through local means like wifi and bluetooth. After making a research about it I found out that Android doesn't have a native wifi ad hoc functionality and that the only way to achieve that is through rooting your device and patching the wpa_suplicant and some other similiar methods which are not generic for every device.
Synopsis of what I am trying to achieve:
An application for Android that scans for devices nearby and tries to connect to them automatically. If the other device also got this application isntalled then it automatically accepts any connection request it receives and when the connection is established it sends back a message which ensures that it has this app installed so that both can start exchanging messages automatically and the users don't have to allow/deny any of the sending/receiving in real time.
My questions are:
Is there any way of sending messages through wifi between 2 android
devices without the use of internet?
Since Ad Hoc is not supported, is there any alternative?
In case the answer to 2 is no , then is it possible to make one of
the devices to be an access point so the other can connect to it and
vice versa.
As for bluetooth, is it possible to skip or automate the allow/deny
pop up of an incoming connection and the pairing procedure?
I'll be glad if you could give me an answer to those and/or any suggestions.
You'll be able to communicate between two devices over wifi without a router/access point using Wifi Direct (P2P) in Android 4.0.
Otherwise, I don't believe you can achieve this over Wifi (bluetooth would be the next best alternative). Since 2.2 you can set your phone up to be a Wifi Access Point (for tethering your device's network connection), but during this time, the Wifi hardware is unavailable for normal use. If you had 3 devices it could work (1 AP, 2 connecting to it).
Is this for a constant connection, or a one-off small delivery? You could use NFC if you want to transmit a URL for example (Android Beam integrates this type of sharing in Android 4.0, but could implement it in 2.3).

Categories

Resources