Broadcast message from Desktop PC to Android Device using WIFI connectivity - android

I want to transfer messages/file from desktop application to the Android device. My question is that can I connect desktop Wifi device with the Android WiFi device without any use of internet connection. I want to use it just like Bluetooth. Is this possible/feasible or not? If it is possible then how can I implement it? And what is the message limit to transfer message/file?
Note : I wanted to use it as real time application.
Kindly suggest me any good approach and if possible then how to do that.
Thanks and Regards Dhaval

Wifi Direct will solve your problem, but there are no public API's available yet for developers. You will have to wait until Google releases it (hopefully soon). Some more reading:
http://www.sfonge.com/forum/topic/when-will-android-open-wi-fi-direct-api
http://groups.google.com/group/android-developers/browse_thread/thread/eb62f0aa0eccf161

Have a look at the Android Notifier application and it's sourcecode.

If you either convince your PC to function as a wireless access point, or obtain a wireless access point, you can set up a network connection between the PC and an unmodified android device. Note that it is not necessary for their to be an upstream Internet connection feeding the PC or access point.
You would then need to write a server running on the phone which listens for inbound TCP connections from the PC. Any android application with internet permission can do this, provided that you use a port number in the unprivileged range. You may have problems with the wifi timing out and shutting down, so you may need to use a timer to periodically trigger a small network operation (ping the access point, etc) to keep it awake. Note that this will use up your battery (what android wants to shut down an idle wifi to prevent).
If you can get both the device and the PC to work with an "ad-hoc" wireless connection you would not need the access point or PC to function as one, however last I heard this required root-level mods to the android device.

Related

How to send data between windows and android without being on the same network and without internet?

I'm looking for a (usable and reliable) way to send data from an Android device to a Windows PC. I'm trying to build an app similar to AirDroid, that can transfer files wirelessly between devices and also mirror notifications. I managed to do this via a LAN connection, but I would like to do it without using any network.
It would be best if it would not require the user to do much work.
Any suggestions ?
PS: The devices will be in the same room
If you want to do the transfer without being in the same connection and without using LAN (or any cable for that matter). I could only think of using Bluetooth.
If your app (at both the mobile and PC side) has Bluetooth permission, you can easily achieve the transfer without much user interaction.
However, this only works for short distances (obviously).
If you're looking for long distance communication, internet is your best bet.

Sharing Bluetooth connectivity over wifi

My computer does not have any Bluetooth capability, however it has WI-Fi capability. My phone has both.
I was asking myself if there is anyway to "stream" Bluetooth over WI-Fi?
Thanks!
The short answer is no. Easiest would be to purchase a bluetooth dongle for your computer.
Yes, tunneling one type of communication through another is generally possible (within the limits of the Android Bluetooth API), but as it is an obscure need you will probably have to write the bridging server to run on the Android device yourself - this is after all a site for questions about software development. Additionally, it will work best when the app hosting the server is in the foreground, as Android makes no guarantees about keeping services running in the background.
On the PC side, this bridged Bluetooth capability will probably not trivially present as an ordinary Bluetooth adapter, so you would be limited to using custom applications which known how to talk through your bridge. The exception would be if you also spend time figuring out how to write a device driver for your host operating system which presents it with traditional Bluetooth APIs, at least to the greatest degree possible.

Web server on Android with remote access possibility

can someone confirm, that it is possible to create a web server on android device ( which uses 3G or 4G internet ) and access it via internet ( from the remote PC connected to the internet, not from the same local network ).
I know there already are some web servers for android ( iJetty, nanohttpd ) and the programms like ksweb, so it seems, that it should be possible.
However, I've done some searching in the internet and some people warn, that mobile devices work using NAT protocol, so it would be impossible.
Can somebody resolve the ambiguity?
Thank you in advance.
No, it is generally not possible. The dealbreaker problem is not with Android, but rather that just about any mobile network provider is going to block incoming connections.
For special purposes, you can do things like have the phone contact a publicly visible remote machine and create a tunnel with something like ssh through which inbound connections can then be sent if there is a server program listening on the loopback interface of the Android device. But this tends to be only useful for things like remote testing.
Were you using wifi you could do this, but you'd need to accept that Android is not designed to promise a high availability of any 3rd-party program. You would need a wakelock to keep the processor running. And you may even need to do things like periodically initiate outbound traffic from the device in order to keep the wifi stack/radio in a fully active mode so that it can accept connections.
Generally speaking, data you want to make remotely available from the device should be proactively uploaded to a mutually visible server. If you want to send requests to the device, look at using something like Google Cloud Messaging which is designed to wake up the device and a recipient application on it in order to deliver a brief message.

Can I use Wi-Fi Direct and cellular data in an app?

I have two+ Android devices. I would like the devices to send instructions to the other devices using Wi-Fi Direct, while at the same time being able to access the internet via their cellular data connection. It seems that using the Wi-Fi Direct interface is being treated as the primary connection, disabling the other connections, just like how Wi-Fi disables the cellular data connection.
How can I programmatically allow both to operate at the same time?
Currently the Wi-Fi Direct receiver is implemented according to Google's Android Developer documents. I was under the assumption that I could use Wi-Fi Direct much like I can use Bluetooth alongside other connections.
Yes it is possible to do that, you can check some articles over here . One of the developers in XDA has developed an application to do that called Super Download Lite and paid version of Super Download - Fast! . You can get details from here and here or you can do some hacking Here is the source code of application which connect to 3G and WiFi to share the connection of the internet (But I am not sure how much it will help you). or try decompiling or revers engineering the Super Download app

How to Cheat Android at checking Connectivity?

I'm doing a network App using tun as virtual network device on Android. I close other available interfaces such as eth0 (for WLAN) and rmnet0 (for 3G/GPRS) but keep my tun0 device alive and add a rule in route table
ip route add default dev tun0
so I can redirect all internet transfer into tun device (what I'm doing here is the same as OpenVPN). And then I saw the data transferring when I ping other IP. Browser and some other Apps work fine.
But some of Android Apps will check the Connectivity by ConnectivityManager before accessing netwrok. Since I close WIFI & 3G/GPRS, ConnectivityManager considers there is no connection, those Apps won't access network anymore.
So my question is:
How to CHEAT android ConnectiviyManager, make it believe that there is still an available connection (for any type)?
I don't think you can do this, and you wouldn't want to, it's a system-wide service. Imagine if your app relied on internet connectivity, but some malicious app was able to tell you there was and make your app unable to complete it's actions. It could cause a serious problem.
If your app needs to believe there is a connection in some states, I suggest you interface the connectivity / network classes, you can read the true state but then return whichever value you deem fit to your app

Categories

Resources