I want to connect my phone to Android studio running on my home PC over my phone cellular network 4G internet.
I've looked up the ADB documentation and saw that remote connection can be done if both the PC and the phone are on the same network so I'm guessing a solution would be to setup some kind of VPN. I'm wondering if there isn't anything simpler that can be done? Something as simple as an app or an Android Studio add-on that handles all the connections and security considerations would be nice.
Related
I have a Samsung Galaxy Tab A 10.1" that I want to use as a second monitor with my PC. Spacedesk works great for my needs so long as I'm on a network with lots of bandwidth -- but more frequently I want to use second-monitor functionality in other environments, e.g. at a coffee shop, where the number of users bogs down network traffic and makes Spacedesk unacceptably slow.
Spacedesk doesn't natively support a wired connection, but for those who want one they suggest using USB tethering, presumably so both devices are on the same network. Problem is, my tablet is the Wifi-only version, so USB tethering isn't enabled. I rooted the device and used adb to run the commands enabling USB tethering as an option. It didn't take - the option never appeared under Settings / Connections. Then I installed ClockworkMod Tether as a 3rd party usb tether app. The PC tether software said it connected successfully to the tablet, but Spacedesk couldn't connect. Next I tried "gnirehtet", a reverse-tethering app. Got it working fine, but again Spacedesk on the tablet couldn't find the Spacedesk server on the PC.
How can I get both devices to be on the same network, without an intermediate connection (e.g. a router), in a way that preserves my PC's ability to connect to wifi, and that will allow Spacedesk to connect?
Turns out there's this thing called "Mobile Hotspot". Of course I couldn't use this on my tablet, as it had been disabled (thanks Samsung). But you can set it up on Windows easily -- in Windows 10 it's under Settings / Network & Internet / Mobile Hotspot. Connect your tablet to that hotspot and Spacedesk works like a charm.
Huge thanks to SpaceDesk customer support, who were extremely helpful in troubleshooting this apparently rather unusual situation. 5 stars both for the product, which I can now use anywhere, and the customer service.
Wifi tethering is possible with the tab A but only on android versions 6.x and below. it can be turned on via usb tethering enabling apps found in the app store that take you to the options in the settings of your device, these options appear to just be hidden in versions lower than 7 but removed in android 7 for whatever reason as the same apps just take you to an empty screen when used with 7.
If you have already upgraded to android 7.0 or above, and having spacedesk work with minimal lag is important to you, then I suggest you roll back youre tablet android version using Odin. This is what I've had to do after updating my tablet today (google it, there's plenty of guides out there)
TBH spacedesk is just poop over wifi. With USB you can watch video no problem
I tried the advice suggested here of using the mobile hotspot on my Windows 10 PC and used an old android tablet to create the extended screen to my PC using the suggested SpaceDesk app and it worked great! The download for Spacedesk for your Windows 10 PC is at https://spacedesk.net/ and the android app is in on the Google Playstore. Give it a try; it worked great for me.
I was connected to the internet over the LAN on my WIFI so I had difficulty in connecting the tablet (Samsung Galaxy Tab 3) over USB. My solution to this problem is disconnect your Laptop from the WIFI router from LAN cable as well as WIFI and use the tether option in tablet and connect it to the laptop and now it will work. Now for using the inter connect your Wi-Fi or LAN cable after this.
I tested the #Twiffy solution "Windows 10 hotspot" and worked for me. I disabled the tablet (Galaxy Tab A7) WiFi and the lag ended.
An application in my pc [Which i don't have and searching for it] that can communicate with an app installed in my android powered device. My android device is connected to PC using USB cable, an example that i came around was Multi Port Terminal, tried it but doesn't seem to work.
Any help would be be deeply appreciated.
I've started a project on Andorid, but I don't know NDK very much. I want to send custom data as per receiving message on usb port. I saw some applications that can send/recieve custom data on usb port if the phone is in recovery. I've programmed usb connection in windows before. But I haven't any clue where should I start in android. Is there any documentation for usb programming for android? If NDK isn't suitable to implement this, which options do I have? It is not important if the application is device specific.
The issues are more of system architecture and permission, an area where the NDK offers little in excess of the SDK.
Android does not really support (direct) custom use of the USB port, at least when the device is connected to a computer (there are some recent options when the device is hosting a USB peripheral). What is possible in recovery mode is essentially irrelevant, unless you want to make substantial modifications to the installation of Android running on your device.
Generally, the only practical way to do application-level communication between the device and a hosting PC is to use the IP networking paradigm over the USB cable. You do this either by enabling USB debugging on the device and installing much of the android SDK on the PC, or by enabling some forms of tethering which may create a general network as a side effect.
For the SDK method, read up on adb port forwards, including the limitation that the PC side must initiate the connection.
It may also be possible to create custom drivers which get a PC to pretend to be an android accessory kit (ADK) circuit and use the apis related to that.
Unfortunately, pretty much all of these ideas are more suitable for developers/power users, than for general consumer application. For consumer apps, most developers ignore the USB cable and do IP networking over WIFI, requiring the user to put the device and the PC on the same network, or proxy through an Internet server visible to both the PC and the device's mobile network.
I'm having Samsung Galaxy S phone.
I want to debug my application, which needs internet connection.
can I debug my app with android device, sharing the PC internet connection through USB?
I can not use WiFi.
Please help me out. Thanks in advance
Getting the internet from your PC to your android device is called reverse tethering. It is tricky cause it s not a built in feature. Some solutions exist if your a linux user :
http://blog.mycila.com/2010/06/reverse-usb-tethering-with-android-22.html
Previous link is dead, found a copy there:
https://web.archive.org/web/20120320173806/http://blog.mycila.com/2010/06/reverse-usb-tethering-with-android-22.html
Don't know if it's still relevant the question is old considering Android lifetime.
If you are not, well I never find a way.
There are two current (2019) tools that do this job well:
gnirehtet
This project provides reverse tethering over adb for Android: it allows devices to use the internet connection of the computer they are plugged on. It does not require any root access (neither on the device nor on the computer). It works on GNU/Linux, Windows and Mac OS.
It's written in Rust and Java; you can choose the server component. It requires adb on the host, and at least Android 5.0. The device itself will then be managed by the program.
SimpleRT
Reverse Tethering utility for Android.
Allows you to share your computer's internet connection with your Android device via a USB cable
This one requires no adb and no rooting, but you have to build the Android APK file yourself or download a release version.
I've been able to find a few posts on StackOverflow about how to control USB devices using an Android phone -- which I understand is impossible (The Android being a USB device and all.)
However, I would be perfectly happy to set up my application to communicate with the other computer (a Linux host) as a USB device. (Like a really expensive mouse...)
Does anybody have information about how to set up an Android app/phone to use the USB connection and exchange data with a host computer. Obviously, it already works at some level -- it's how Eclipse and Android SDK/debugger do what they do, but I'm still looking for some way to do this in an application.
(My current phone, BTW, is a Droid Incredible.)
Thanks,
R.
Basically you'd need to install the USB device driver and the ADB toolsuite from the SDK, either that or reverse engineer their functionality and build it into something else.
Then you enable USB debugging on the phone.
And then you can do something like an adb port forward to allow an application on the pc to connect to a network socket listener on the phone. Note that connections cannot be made in the other direction, but once a connection is made it is bidirectional.
If your version of android supports tethering over USB, you could also leverage that to implicitly create a network between the PC and the phone, at which point you can make connections in either direction. Just make sure nothing starts accidentally pumping lots of data through the phone's mobile network!
(Many android phones actually can experimentally function as USB hosts, but you have to compile new drivers into the kernel, install the new version, and make up a cable to provide USB power to the device as the phone cannot. Also you lose the ADB over USB channel which makes debugging a pain)