Android Things on Raspberry Pi 3 the WiFiDirect not working


Android Things on Raspberry Pi 3 the WiFiDirect not working



I am trying to get WiFi Direct (aka wifi p2p) to run on Android Things 1.0.1, Api version 27, Raspberry Pi 3. I am following this demo on Android Developers Demo web site.



The problem is the line:
mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);


mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);



always returns null.



Questions:



1) How do I get this example to run? Does Wifi Direct run in Android Things?



2) Is there an alternative to WiFi direct that will allow the Raspberry Pi to connect to a Android tablet or iOS tablet running a browser, one that does not require a stand alone wifi router/hub?



3) Am I missing some reason that would prevent Wifi Direct from being implemented in the future?





Possible duplicate of WiFi P2P network in Android Things
– Andrii Omelchenko
23 hours ago




1 Answer
1



If what you want is the Android things to work as a web server, you can use nanoHttpd for it. But as far as I understand, the connection method and it being a server are quite unrelated questions.



You can see an example of nanoHttpd on Android things here: https://github.com/plattysoft/SmartPopcorn/tree/nanohttpd-api?files=1





Correct, Thanks for your answer. The android app is using nanoHttpd, The important part of my question is 'Does WiFi Direct or some other tech allow me to connect to an Android Tablet?'
– fishjd
20 hours ago





What I have done myself is to create a REST API using nanoHttpd and then write a mobile app using retrofit. As long as you use the IP protocol, the lower layer is irrelevant.
– shalafi
15 hours ago





Shalifi, you are correct the lower level is irrelevant in most cases. The application runs in a secure environment with no WiFi and a WiFi router is not allowed. The app works great using Android Things, NanoHttpd and a WiFi router. How to eliminate the router? WiFi Direct would be the ideal solution, but it does not work. Setting the Raspberry Pi as hot spot doesn't work on Android Things either.
– fishjd
13 hours ago






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Export result set on Dbeaver to CSV

Opening a url is failing in Swift