connect to android devices using wifi direct without prompt - android

i am trying to connect two android devices using WIFI direct and i was successful. But the problem is the second device has to accept the a connection prompt after the other device initiates the connection. It is undesirable for what i am trying to achieve. I saw a few post here in stack overflow itself saying that currently its not possible. But came across an app called SUPERBEAM which user WIFI direct but without the prompt. A search in google gave me the following link from xda forum which says
SuperBeam creates an access point using Android's WiFi direct API's.
This essentially works like hotspot mode in old devices, but it is
guaranteed to work on newer devices like Nexus 7. Moreover, this mode
allows older devices to connect and receive files without having to
support WiFi direct's peer-to-peer connections and, more importantly, it
gets rid of the annoying "accept connection" prompt.
But no where i found information on how to implement this. Can anybody help me. Here is the link
http://forum.xda-developers.com/showthread.php?t=2177133

You could indeed simply use the createGroup function from the API to create a group, which also makes the access point. The first problem here is that the access point name & password are set automatically, and you can not change them.
So, you do need to pass the info to the connecting party, and for this, I would suggest using the local service advertising, and using the instance name there.
Did make simple test app for this and you can find it from Github under DrJukka/MyWifiMesh, also some discussions on the topic can be found from my blog

This can be achieve using Xposed framework. You need add the code and install the App. The phone needs to be rooted in order for it to work. I have tested it on multiple Samsung phones and it works.
Check this answer for details: How to auto-accept Wi-Fi Direct connection requests in Android

Related

How to block specific urls in Android

I am developing a parental kind of App in which there is a requirement to block specific urls from all the browsers in the Device. I think this is an old question but couldn't find any solution yet on stack.
Do you have any working solutions. Assumption - The device is rooted.
Regards,
sha
I have two resources for you:
Since the device is rooted you can work directly with iptables. iptables will give you very precise control over all coming and going data packets. Check out open source projects like AFWall+ on GitHub for iptables in action.
If you want to be able to run your app on unrooted devices look into creating a fake VPN. You don't send any data to an actual VPN server, you simply use the VPN API to filter all the information coming and going. Check out Disconnect (whenever they actually share their open source code...) or OpenVPN which is what Disconnect builds on.

Sharing Data between Smart Devices without wifi

I have heard of communication between two android devices using that touch method or however that works. I understand that communication over WiFi is not a problem. I need to know if it is possible to create an app that would run on multiple devices but in the end would compile data collected on each device into one main database all done without WiFi. It just sounds like a hogwash idea in my mind but is this possible?
There is app call SuperBeam.You'll need SuperBeam installed on both devices and then you'll need to pair the devices using any of a number of methods, including QR Codes, NFC, or by typing a manual code.
https://www.youtube.com/watch?v=hGAAE7qru6g
youtube link if you want to see how to use SuperBeam app
Correction:I tought this app don't use wifi but i guess this app for devices aren't connect to the same Wifi

Android Wifi Direct: Avoiding user acceptance when connecting to a known peer

While connecting to a peer using WiFi Direct, user's permission is required. I know that connection can't be made without user never giving the permission and there's a feature request for this kind of functionality:
https://code.google.com/p/android/issues/detail?id=30880
But I don't need this feature, asking for permission on the first connection is OK (also, more secure). Is there any method such that the permission is asked for the first time only? And when trying to connect to same peer later, the permission is not required.
From the P2P specification we can find something called "persistent P2P group" which is intended to re-establish a group without user-intervention.
In a persitent P2P group the Group Owner stores the credentials of the group so that the group can be re-established in the future by the request of any group member without the need of user intervention.
Such a group can be formed by specifying persistent while connecting using command line (see the P2P of wpa_supplicant and search for p2p_connect command https://android.googlesource.com/platform/external/wpa_supplicant_8/+/ics-plus-aosp/wpa_supplicant/README-P2P). But I don't know if the option is available with the current devices.
Edit:
See the answer to the question Can I change the group owner in a persistent group in Wi-Fi Direct?
Since I worked with Wi-Fi Direct on Ubuntu, I used wpa_cli (which comes along with wpa_supplicant) to create a persistent group as specified in the p2p_readme file.
The closest thing to have Wi-Fi Direct features without prompt I've managed is to use Service Discovery combined with legacy mode, i.e. when the connection is supposed to happen, you don't use WifiP2pManager.connect() but WifiManager.enableNetwork() instead.
I'm the author of a very simple P2P stack which automates all the magic, you can check out an example on https://github.com/croconaut/wifon-mini to see how well/bad it works (plus some documentation).
Unfortunately, not at this time. Perhaps in the future, or if you write your own ROM.
I am using two HTC One V's as well as an HTC One X+. I've been running the WifiDirectDemo given by Android. Apart from switching Wifi Direct on, no other setup is required. I simply press a search button in the application and peers are listed.
I did at first think I needed another devices permission as you've described, needing to reenable it every time I installed the application on my devices. But this was before I noticed the search button in the application, and realised this was not required.
Could you have made the same mistake as me?
Its possible through the reflection method.

Manually pairing Bluetooth Decives in Android?

I was reading this
http://developer.android.com/guide/topics/wireless/bluetooth.html#QueryingPairedDevices
which is allot of help on how to pair,connect to a bluetooth device.
I have a situation where I have several BT devices that are in Non-Discover mode always. I know the MAC and the PIN of these devices. IS there a way in Android Dev to manually add devices to the PAIRED list so i can just use the connect as a client.
I understand this maual is written allot for V3. i think i will need to do this on 2.0 ; 2.1- has anybody done this before?
Basically these devices I want to connect to are power saving modules I used pre built BT modules to monitor daylight, another one humidity, etc.. every 3hrs or when interrupted and runs of a single battery for months. So turning off divcory on server saves immense power and prevents other people trying to connect and waste battery.
Not sure what you mean by "manually": Do you mean "manually" as in GUI/user interaction, or "manually" as "I do it in my own application code"?
Some suggestions though:
If you can make your BT devices discoverable at all, you could do it this way:
Make your BT device discoverable
Let Android search for and find the device and then initiate a connection
Android will ask for the PIN for pairing with the device; enter the PIN.
Once pairing was successful, Android stores the pairing information for future use, so that you can
Make your BT device invisible again.
From then on your app should be able to connect to the BT device at any time without further pairing operations.
If the said is not an option for you, maybe you want to go another way:
In current Android versions there are different API routines implemented which are neither documented nor exposed in the normal SDK. A hack kind of solution may be to use some of these "hidden" ("#hide"...) APIs, either via reflection or via modification of your SDK installation.
But be aware that this is always a hack and it may work on a specific device with a specific version of Android and is likely to break your app on another device and/or any other Android version.
Having said that, here comes some reference:
Example of how to access "hidden" bluetooth API.
Then, have a look at the source code for android.bluetooth.BluetoothDevice, e.g. here.
In there, public boolean createBond(){...} may do what you want.

Android Wifi direct multiple connection ad-hoc

I try to create an ad-hoc network between many Android devices, but I can't find documentation to do that.
I thought Wifi direct could work for what I want, but is it possible to have multiple connection on one device ? I saw that we could do a device acting like an access point and communicate with many devices, but can we communicate from one client device to two access point devices ?
I have for example 3 devices: A -> B -> C
The "A" device need to communicate with "C" device but he's too far away, so I want to have ad-hoc wifi direct connection between A&B and ad-hoc wifi direct connection between B&C, so A can communicate with C. It should also work with more than 3 devices.
Thanks !
Here is the link to the Wifi Direct Demo http://developer.android.com/resources/samples/WiFiDirectDemo/index.html
I have been working on establishing ad hoc communication over Android phones for a month. I am trying to create an app that could work without having 3G or access point. Main idea is to let the clients to be able transfer voice or data in a close range.
There are some guys implemented a basic system regarding almost the same topic. It basically works with Wi-Fi access point. So you need an access point in order to establish the connection. Although this is not what I am looking for, it might be helpful for others. You might need to contact them for more details.
https://sites.google.com/site/androidwalkietalkie/home
Android does not have support for ad-hoc WiFi at this time -- sorry!
Update (2019): Android has supported WiFi Direct for a while, and this answer has not been updated.
Your scenario would work. A would be able to connect with C as long as B (the group owner) is within range of both A and C.
See Android's developer documentation for more info:
https://developer.android.com/guide/topics/connectivity/wifip2p
At this time only Galaxy S 2 support Wi-Fi Direct
The wifi direct supports concurrent hosting and client capabilities on single interface. Which means, the device will act as an AP, allowing other devices to connect to it as clients, And also connect to another AP as a client. And can share internet connection by driving the internet traffic between the interfaces.
However, current implementations of wifi direct on android are specific to the phone and not part of andorid sdk. So there is not much clarity if they support concurrency. This capability is not limited by hardware.
Ad hoc wifi is disabled in Android. You need to ask Google why they have chosen to do so. If you have access to a device that allow you to install custom Android images, you will be able to patch Android to support it. Or you can root your device and reenable ad hoc Wifi, there are plenty of solutions on the web on how to enable ad hoc on rooted Android devices. This is a software issue, the hardware on every Android device that I know of has support for ad hoc Wifi.
The Serval Project, based in part on WiFi Tether, is the only place I've found this functionality. It's still alpha phase, but seems to be the forerunner in the field. The wiki is much more useful than the main project page linked above, with installation instructions and a bit of documentation.
Serval may or may not be right for your needs, but I felt it should be pointed out that ad-hoc networking is not impossible on Android. It might be better to wait until Google gets around to implementing it as standard API, though (if you believe they ever will :) ).
Well You might be interested in looking at AllJoyn. It is qualcoms SDK for android OS which includes wi-fi peer-to-peer implementations by creating adhoc connections. This is same as Wi-Fi Direct.

Categories

Resources