I want to create application which I want to use to turn off my computer. I think about connection phone with computer in WIFI. But I don't know how can I send commend to computer and how computer translate this commend and turn off computer. Can you show me the way how can I start and what I should to know to create application like this?
You can achieve that with the client/server paradigm. You'll need to develop an android app that will work as client and a pc app that will work as server.
On the server side you need to wait for two commands:
Discover: Used for the client to know what servers are available
Action: Used to let the server know that it must shutdown itself
Related
I want to control Raspberry Pi 3 with an android application via WiFi, without external modem/router/...
This application needs to do the followings:
send commands to RPi
send/receive files to/from RPi
So far, I have setup RPi as a wireless access point, and I'm able to find RPi in my android phone via WiFi and connect to it.
But the question is how can I communicate with it after being connected !?
Firstly, I thought using SSH. I tried some ready apps like JuiceSSH. And it was successful. I was able to SSH into RPi and execute commands.
But then I thought maybe there's no need to SSH. Because the RPi itself is a wireless access point, and my android phone is connected to it.
Now here is my question:
Are there any methods (other than SSH) to send commands to RPi or send/receive files to/from RPi after connecting to it !? If so, how can I implement it?
Any sample codes or examples are really appreciated. Thanks.
I don't see a point of not using SSH merely because RPI act as as Wireless access point. Anyways if it's a basic Shell access you need to the RPI from the phone, SSH or Telnet can be easy to setup.
If you are in capacity to implement your own server inside the RPI by code and do something inside the code, gRPC can come handy, given it's available in many languages.
Ex: gRPC server in the RPI, gRPC client in the android app. Basically gives simple client-server system.
There are many other ways to achieve the same thing, depending on your exact requirements and constraints.
Or you can simply start a webserver inside the RPI and use the browser in the phone to access it. This seems more simple and robust.
http://www.instructables.com/id/Python-Web-Server-for-your-Raspberry-Pi/
http://www.instructables.com/id/Raspberry-Pi-Android-App-communication/
I'd like to create and Android app which allows me to control some aspects of my computer (volume, open pre-defined URL's..etc).
Would it be feasible to create a Windows client from an Android device? I'd like to access my PC's terminal in order to execute some commands.
If so..could you please point me out the right direction?
One possibitly (maybe not the best one) would be to host a apache webserver with access to the cmd by executing it with PHP. You could predefine commands which you call from specific URL paths like http://192.168.1.1/myHomeControl/muteSpeakers/ for muting the speakers.
You can execute cmd commands in PHP with
exec('ping');
or
system('ping');
Then you just need to call the URL from your android Device and it should work.
There are many ways to control Windows machine from another device. Every type of connection depends on particular type of protocol. And as result each protocol has its own rules, pros and cons and restrictions.
You can connect to the machine by SSH using JSCH. But you also need to install SSH server on your machine.
Or you can develop your own protocol using TCP/UDP as transport.
Try this software -- https://play.google.com/store/apps/details?id=com.sonelli.juicessh
Install the ssh on your machine:
For Mac:
http://www.maclife.com/article/howtos/how_enable_ssh_your_mac
For
Linux:
http://www.cyberciti.biz/faq/how-to-installing-and-using-ssh-client-server-in-linux/
For Windows:
http://comptb.cects.com/install-configure-ssh-on-windows/
Connect to it and do whatever you want to do. Have Fun!
If you want to create an application, than there is two options again: either you create a SSH tunel to the pc and you kinda let the user configure their SSH or create an External APP such the PHP , or VB.net that kinda detects by protocols and different ports the access to the machine.
I use this software to control volume and stuff : http://www.unifiedremote.com/ it is pretty good when it comes to control the laptop and and certain types even using the mobile as a mousepad -- To do this they created a software that needs to be installed on the machine to control doing so lets call this software the CONVERTER / RECEPTOR that converts all request that i do from mobile to the pc. Seems simple but not rlly :)
Regards!
I need to send an image file from the mobile to the server(where the server will save it to the hard disk). I have wrote both the android mobile part and the server side. I need to test the code before deploying to the server. Will the code work if I connect the mobile to the WI-Fi network through which I can have a LAN connection to the system? Is there any way I can test the code with out using a WI-Fi connection(ie Connecting phone to the system via the usb cable and then forming a LAN or something)? Please voice your valuable opinion in these stuff.
When I was testing my server-side I didn't find any other way rather than connecting via wifi, this way it was working just fine (in your code you need to use ipv4, not localhost, just as reminder). I'm not good with network stuff, but I don't think it's possible using usb to create some kind of LAN.
Have u tried from emulator? How to connect to my http://localhost web server from Android Emulator in Eclipse
I have to connect my Android device to my computer via internet connection. How do i go about doing it?
Create a webservice which the application talks to? ( But how to receive the data from webservice on my computer? )
You are on the right track. Look up REST APIs. You can either run the web service in the cloud somewhere and let both the Android and the PC connect as clients, or you can put a LAMP stack on your PC and run the web server and database right there.
If you allow direct USB connections, then you can also get the data off using ADB or Android File Transfer, without even using your app directly.
I have an android application that talks to a server app running on grails (Groovy on Grails).
Android app basically establishes a connection with this address:
url="http://192.168.2.53:8080/tma/majBtm/androidToDesktop";
It all works fine when both the server and the android phone are connected in the same lan network.
Now the problem arises when I want the phone to talk to the server while the phone is outside the local network (I need it to use edge).
I came across VPN networks which I think might help me out. (the server has dynamic IP)
So what i did was go to dyndns.com and created a new hostname and have the app successfully run on the server. The host I created was - tmagrails.dyndns.com
How do I make my phone connect to this network? What changes am I supposed to make in order to get things working?
Also, I really want to know if this is the right approach. If not, is there any way to get things going for me?
Please advice.
First you need to set up port forwarding so that port 8080 is forwarded to your 192.168.2.53 ip address. A google search on your router model should tell you how to do this. If you want to make your app more secure you will also need to look at SSL and TLS While this won't garantee your app is secure it will stop the network traffic to your app being easily read if you were to access it from an open wifi hotspot.