开发者

How do I connect from android device to computer via WLAN?

开发者 https://www.devze.com 2023-03-14 00:35 出处:网络
I am writing an android app for a friend of mine who is a DJ.Instead of guests writing requests on a sheet of paper, he wants them to request songs through his android tablet.I have the app working th

I am writing an android app for a friend of mine who is a DJ. Instead of guests writing requests on a sheet of paper, he wants them to request songs through his android tablet. I have the app working through the开发者_JS百科 internet but some places may not have internet. One solution was for him to bring a router and just connect the laptop to tablet that way.

My question is: how do I connect the two locally? What would the ip address for the laptop be? Where do I have to look to find it? Is there an easier way to connect the two?

I'm a pretty big networking newbie.

Thanks, Eric


A really easy way to do this would be make a small webapp to run on the laptop, and just point the android tablet's browser to the laptop's web server. If you want a little more control on the tablet's browsing (so browser controls aren't available so people can't navigate away from the app / bring up "inappropriate" websites / etc.) create a little android app with a webview to load the webapp.

Edit: This assumes you have a router or something to create a network connection between the laptop and tablet. You could set up the router to always give the same IP address to the laptop and tablet. The specific directions for how to do this depend on the router you have - but for most you just go to the router's IP address (usually 192.168.0.1 or 192.168.1.1), login as an admin, and follow directions to set up "static" or "fixed" ip addresses for devices connecting to the network.

Depending on what other forms of communication the laptop and tablet have in common (bluetooth? IR port?) you could write an app on each computer to talk to each other without needing a router - but writing these programs is going to require writing a lot more "lower level" communication between the two apps than using HTTP.


You would have to configure the access point/router to grant a fixed IP address to the Android's MAC address and do the same for the laptop's MAC address.

Write a small web server on the tablet that refreshes the page after each new song request. Have the laptop web browser connect to the tablet's fixed IP address by visiting http://192.168.1.1, but of course replace this number with the IP address you configured. You could also reverse the roles and submit the songs via the tablet's web browser on a web server running on the laptop. And tell your client to keep a close eye on that tablet!

0

精彩评论

暂无评论...
验证码 换一张
取 消