Get Internet Access on a Android device from a smartphone without hotspot - android

I have an Android device that has wifi and Bluetooth modules. I want to build applications to connect the device to the internet using a smartphone's data connection. Is this possible?
The smartphone will have wifi as well as data connection. Can the smartphone's data connection be shared through Bluetooth? Or is there better alternatives like wifi-direct or NFC? I am aware that enabling Hotspot on the smartphone is an option. But with hotspot, the issue of wifi being turned off makes it not usable for my use case. Is there any alternative to wifi-hotspot?
What will be the best option for this and what things should I consider when building my applications and services?

NFC is definitely not the answer, the data rate is far too slow and the connection unreliable and the OS does not allow it.
You might be better with a USB ethernet adapter if your phone support USB On The Go (OTG)

Your phone should already support sharing a data connection using Bluetooth. This is called Bluetooth tethering. But you also have wifi, so wifi tethering is also an option to share your data connection. No additional app is required.

Related

Prioritize WIFI connection instead Cellular data

We are developing an application that connects to an external device using WIFI, but this external device has no internet access.
In Android M we have realized that the System prioritize a connection with internet access, so the device uses Cellular data to connect internet instead of WIFI.
The problem in that behaviour is that we are not able to access the external device due the device is connected via cellular data instead of WIFI.
Is there anyway to prioritize Wifi connection over cellular data?
Thanks in advance.
I think this is what you are looking for : http://developer.android.com/reference/android/net/ConnectivityManager.html#bindProcessToNetwork(android.net.Network)
And here is similar problem, just the other way around :
How to use data connection instead of WIFI when both are enabled?

How to communicate two android phones without using internet, bluetooth or wifi connection?

I want to create an android application.
Is it possible to send a notification from my phone to other phone which has enabled its WiFi hotspot.
I mean, one phone has enabled its WiFi hotspot and I scanned available WiFi devices and I saw its WiFi hotspot ssid at my available wifi list and I want to send a notification or a message without connect its wifi hotspot point, or using bluetooth or using internet.
Is it possible?
There is also NFC - Near Field Communication. It has nothing to do with Wifi though.
So in theory, yes, I believe you can do what you asked. I think you can react to the presence of the other phones Wifi hotspot, but communicate on NFC instead.
As for sample code, I can't help you. I haven't written anything using NFC.
There is also sms or a phone call

Android Wi-fi AP hotspot - without internet

There are lots of post on SO regarding setting up AP (Hotspot) on android mobile. However, in all these cases, the AP is a conduit to the outside internet world. In my case, I just want a server application running over a mobile setup as an AP. And let all the client android mobiles connect to it, send their data and disconnect if they like. No internet connection is assumed (i.e, no gprs/3g etc).
My observations: If I setup a wifi AP (via settings -> tethering and portable hotspots) when it is also connected to GPRS, then another android phone can successfully connect to this AP and send the data to the application. However, if I disable the GPRS, even though the client shows that it is connected to the AP, it can't seem to send any data. It seems that an external internet connection is a necessity for the AP mode to work.
Is this understanding correct? Or am I setting something wrong?
I know that I am late to the party (more than 3 years late :) but I was searching for a solution to this problem and stumbled upon an easy workaround. I am using a Nexus 4 with Android 5.0.1 and I can easily configure my phone to use it as an Android Wi-fi AP hotspot - without internet. Just go to Settings / Data Usage and disable "Mobile data" option under the Mobile tab. Then enable the WiFi hotspot option as usual.
I was trying to get this working in order to play with a VirtualBox machine from VulnHub.com that asked for a Bridged Connection when I was commuting to work (no Internet, but with my laptop and my mobile phone I was able to make it :)
I think you have used the internet IPs in your code not the local IPs for communications,is'nt it?
I have the same use case and was looking for the same info as you are. I checked that some of the WiFi-only tablets do not even have a HotSpot setting. Even the devices that do have it, if I remove the SIM card, I cannot enable the HotSpot (I get a message asking me to insert a SIM first).
It looks like our use case is not supported by Android. Rather, the HotSpot feature was not designed with our use-case in mind. I mean, why would an end-user want to use an Android phone or tablet in a HotSpot mode if it didn't also provide outside connectivity?

Are any android devices capable of connecting to an AP and another device simultaneously?

Since I don't have an Android 4.0 device I haven't been able to test this myself. Also I wonder if connecting device A (a smartphone) to device B (a wifi direct capable device) using Wifi direct would mean that device A would assume it is provided with internet from device B (tethering?). I am trying to make an application for device A that would communicate with a device B that does NOT provide internet, thus it would be interesting to know if such a scenario would lead to device A losing internet connectivity for the duration of the connection. Is the situation different depending on if device A is connected to internet through an AP or through 3G/4G?
Perhaps using Bluetooth would be a solution, but in my case security is an issue, and it seems to me that Wifi direct provides stronger security (WPA2).
Any info would be helpful!
/S
On Android, Wi-Fi Direct doesn't interfere with your connection to the Internet (Wi-Fi or 3G/4G). A problem may be that once your turn on the Wi-Fi (to enable Wi-Fi Direct, your phone will try to connect to one of the saved available networks and will disable your 3G connection. That is because Android (by default) doesn't support dual connection (via both Wi-Fi and 3G/4G), but there is some applications around that claim that they can provide such functionality.

ad-hoc wifi on Android

Is it possible to connect two android phones (rooted) with wifi programatically and exchange data?
I know it is possible to do tethering using wifi-android-tether. But i need to establish the connection, and exchange the data, all through my android application. User intervention like switching on the android tether app manually is not allowed.
SO basically its like, if i run my app on two droid phones, they should do the following,
Detect that they have wifi.
DEtect that the other phone has its wifi on.
Establish a connection ( similar to a PAN in bluetooth ).
Exchange some data.
Use WiFi Direct. The sample codes in the SDK package will do for testing Peer-Peer connectivity.

Categories

Resources