I created a service on an Adroid TV and I'm currently trying to discover that service from another device using mDSN Service Discovery protocol. When I put the Discovery app on a 2nd device, it was able to detect the service on the 1st TV just fine. But if I put the Discovery app on an android emulator, it can't detect my service on the TV. From all the research I've done, it seems like each Android Emulator is in its own private network and can't really talk to any other devices. I'm not sure how to make this work and I found something that seems like a solution at this link Set IP Address for Android Emulator, except it didn't work on my machine. My emulator didn't have 2 ethernet interfaces like the example, after the bridging is done, I also lost Internet connection on my host machine. I'm at a loss of what to do. Is this even feasible to get my emulator to detect service on an actual device? If it is, then what am I doing wrong?
Using adb forward to make a port on the emulator accessible from the host
see more on James' Blog
Related
I need to make an Android app for the problem mentioned in the title. This system already runs on Windows and is connected to the computer via an UTP cable. Now, I need to connect to the local network that I already did by connecting it to the router (I'm not sure if this is enough, but using the Fing app I detected the device in the local network), and build an Android app.
Just to mention I have tried NSD (link below) but I do not think the alarm system supports it.
https://developer.android.com/training/connect-devices-wirelessly/nsd.html
I had a problem defining the type of service. I tried to find all the devices using the code below, but unsuccessfully.
private static final String SERVICE_TYPE = "_services._dns-sd._udp";
Using this type of service I could not find anything, i.e. I did not manage to trigger the method
public void onServiceFound (NsdServiceInfo service)
My question is, should I continue with this approach (is it possible at all)? Otherwise, I need some guidance on how to connect to the device and read data(string type).
For now, I only have the IP address I received using the Fing app.
I found a partial solution for my problem. This is how to connect device and check are data is transferring (in case the someone have similar problem).
You need to do next:
connect device direct to yours computer with Ethernet cable
used WireShark app to find ip address, port and protocol (utp
protocol in my case)
after get device data, disconect device and reconnect directly with yours modem (no need for aditional device like ethernet switch, or to do the port forwarding)
you can use some udp client app on android phone to check if data
are receiving (I used TCP Sender / Receiver). Just set ip address
and port.
My problem was because I used wrong UDP client app. That's the reason it didn't working from the beginning.
I'm going to fly out of state tomorrow, and it'd be ideal if I was able to continue working on my Android app while I'm in the air.
The problem is, my app requires a backend service that I can run on my laptop (OSX). At home this is simple, because I'm on my local WiFi network and I can simply connect to a box with the service hosted on it, but I'm not sure what would be the best way to debug the app over USB only.
I'd really much prefer to not share a local WiFi network through my laptop due to battery usage - it'd be best if I could leverage the USB connection I already have to debug and create a local network between my phone and my laptop.
I've seen a few other posts that mention I should be able to select the USB Tether option, but when I tried it, it first attempts to contact my provider (Verizon) to see if the feature is available. When I put the phone into airplane mode, it's unable to communicate with my carrier, so it doesn't look like this will be possible in the air. Regardless, it doesn't seem to work out of the box on OSX.
In reality, my local service situation is a bit more complex than average (it actually runs in a VM). The ideal situation would be to create a local network between my computer and my device, so it can access all VMs (Vagrant/VirtualBox) within the network.
If I'm reading this question correctly, it looks like there may be other solutions for Windows, but I'd really rather run it in OSX if that's possible.
How can I create a local network between my laptop and Android device over USB?
I would like to know if there is any way to connect few android phones together? For example, one phone acts as the host and the rest connect to it?
I'm planning to make a game, but I need some connection like this (without Internet connection).
Thank you.
What you're asking for is done by Android Network Service Discovery (NSD). Via the framework you can connect devices without Internet connection (over Wi-Fi/Wi-Fi Direct).
Conceptually it looks as follows:
One device register a service (host);
Other devices discover the service and connect to the host (clients).
Here is a good sample app which may help you start.
I'm writing an android application that searches for devices using the UPnP port 1900, but when I telnet into the emulator and try to set up the port redirect like so:
redir add udp:1900:1900
It says:
Can't setup redirection, port probably used by another program on host
Port 1900 is being used on my computer by the Microsoft Plug and Play service and apparently cannot be disabled.
Is there any way around this? Short of side loading the apk on every change, what options do I have to test while developing?
I'm hoping I'm missing something obvious.
I was able to disable the SSDP Discovery Service in services. This freed up port 1900 and the above emulator redirection command now works. Even though this service will restart when I restart the system, it will allow me to debug and test via the emulator.
My company requires VPN to connect to our dev systems and for the first time I'm trying to work on an android app from home. Turns out the emulator doesn't want to use the VPN interface so even though I have connectivity to our dev systems on my VPN-connected laptop the emulator that's running on it does not.
I have thought of 3 solutions to this:
run a VPN client on the emulator, but I was hoping for a simpler solution than that
setting up a proxy server on my local machine
forwarding a port on my local machine
2 and 3 can probably work, but I'd still like to know if there is an easy way to get the emulator to use the VPN interface without a workaround.
I'm running OS X 10.7 and I've already tried adjusting the interface priority order with network>>set service order.
I suppose I can dust off the old dell and try it there, but I would expect the same results.
First start your vpn connection and then restart the emulator, now the emulator should use the host vpn connection.
it's mostly because of the DNS issue, according to the android doc:
At startup, the emulator reads the list of DNS servers that your system is currently using. It then stores the IP addresses of up to four servers on this list and sets up aliases to them on the emulated addresses 10.0.2.3, 10.0.2.4, 10.0.2.5 and 10.0.2.6 as needed.
I encountered this issue and tried something on dns settings but I could not solve it. As #machado said in the comment section below you should boot the emulator via "Cold Boot Now" option. I hope this helps.
What I do on my mac is just make sure 'send all traffic over vpn' is checked.
You'll find this setting after you click advanced while having your vpn connection selected in network preferences.
Works well for my situation, but may not depending on the type of VPN you're connecting to.
I had the same issue and solved it by connecting to cisco vpn after the android emulator has started and connected to the internet.
Works for me in windows 7
I setup a vpn connection on Windows. Then I started the emulator. The emulator and everything on my pc started to use that vpn connection.