Automatically accept wifi direct connections through root - android

In Android SDK the Wireless P2P (WiFi Direct) API is provided.
I am developing an application that would require for the app to connect to other devices on the fly that have the same application and share information among them (text data). In order to do so I require that the devices could connect automatically between each other. I was wondering if there is a way to do it if you have root permissions on your device. And another thing is if it is possible to work around by creating some kind of automate response of clicking the OK button on the dialog of the user request.
Best regards.

It can be done with the help of some classloader patching framework, like Xposed or Substrate. See my answer here for detailes.

Related

Is there any way to transfer data between Android devices without the user having to accept a connection?

I am currently researching task offloading strategies for mobile devices and need to be able to transfer data between devices automatically without the users being on the same WiFi network. As far as I know the user needs to explicitly accept connections both with WiFi Direct(P2P) and Bluetooth.
Is there any way around the explicit connection acceptance? Does other/better options exist?
Anything goes as long as it enables me to share data between devices in an ubiquitous fashion. Preferably without rooting the device.
An alternative is the Google Nearby API. It allows you to discover, connect and send data to nearby devices without any promt and without having to root the device.
Some documentation can be found here: https://developers.google.com/nearby/connections/android/discover-devices
A good code example can be found here: https://github.com/android/connectivity-samples/blob/a7df97eee9b2a553760d338babc6f24e4dc73cf7/NearbyConnectionsRockPaperScissors/app/src/main/java/com/google/location/nearby/apps/rockpaperscissors/MainActivity.java

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.

Android: Pure P2P chat application

I've started to develop a chat application for Android. This app is supposed to function without internet and, most importantly, without an access point; It has to connect Android devices in a pure P2P manner.
However I've followed the following tutorials posted in android developers guide:
http://developer.android.com/training/connect-devices-wirelessly/nsd.html
http://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html#fetch
Afterwards, I've tested my app on 3 devices, the problem is one of the devices acts as an access point, preventing other devices from connecting with each other if they are connected to it.
This doesn't work for my app, because I want each user to be able to connect to multiple users at the same time.
What do you suggest I do in order to achieve pure P2P connection for my Android app?
Does the group owner acts as an access point?
EDIT
After I've done some research I found the WiFi Direct is not suitable for my project since it has to assign a device as an access point, what I'm looking for is WiFi ad hoc mode or (IBSS) in Android Anybody got any suggestion on how to start working on that?
By using bt and wifi simultaneously, you can try to extend the network further. This will require some kind of packet routing.
Also, it seems android ignores wlan cards connected to usb otg - just plugging in extra wlan dongles could allow easy extension of network.

Enter WPS Pin on Router from Android

How can i enter a WPS (Wifi protected Setup) Pin on a router programatically using Android SDK??
In addition can i get the responses that the router sends?
Thanks
Samsung has added this as a feature to some of their phones, but it is not a default feature of Android. That being said, I doubt that there is going to be a simple way of implementing this. Chances are you are going to have to learn about how the WPS protocol works and implement it yourself from scratch. This will involve broadcasting the correct signals over the WIFI, and performing the secure handshake with the router. I don't know much about how this works, you'll have to look up the WPS protocol.
There is a good chance that your app will require root access as you will need to alter WIFI network entries on the phone, and perhaps even add support for storing this information.

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