Giter Site home page Giter Site logo

varunon9 / remote-control-pc Goto Github PK

View Code? Open in Web Editor NEW
191.0 20.0 99.0 67.76 MB

Control Laptop using Android. Remote control PC consists of android as well as desktop app written in Java to control laptop using phone.

License: MIT License

Java 71.16% HTML 28.84%
control-laptop android desktop phone remote-control file-transfer-android

remote-control-pc's Introduction

Remote Control PC

Use your Android phone to control your Laptop.

Features

  1. Control Left Click, Right Click, Mouse Scroll
  2. Type text
  3. Transfer files from phone to laptop
  4. Download files from laptop to phone
  5. Use your laptop as speaker to play mp3 files of phone
  6. See images of phone on laptop
  7. Control presentation on laptop via phone
  8. Suspend, Restart or Shutdown your laptop using phone
  9. Fetch your laptop screen to Android (only single click supported)
  10. Browse Android files on Desktop (View and Download)

Android app link

Android App

Desktop app link

https://github.com/varunon9/Remote-Control-PC/blob/master/RemoteControlPC-JavaFXML/store/RemoteControlPC.jar

How does it work?

Step 1:

Start hotspot on phone and connect your laptop via wifi

Step 2:

Open the desktop app on your laptop (See instructions below)

Step 3:

Open Android app and enter connection details provided by desktop app to connect

Step 4:

Enjoy ✨ 💥 😉

Dependencies

You need Java 8

How to start desktop app?

  1. Clone this Repository / Download zip
  2. Open terminal (Ctrl + Alt + T)
  3. Type cd /path/to/repository/RemoteControlPC-JavaFXML/dist/RemoteControlPC.jar
  4. Type java -jar RemoteControlPC-Desktop.jar
  5. Lock icon to launcher
  6. Make sure you have Java 8 installed (hit java -version)

How to start android app?

  1. Install apk from /Remote-Control-PC/RemoteControlPC-Studio/app/build/outputs/apk/app-debug.apk
  2. Connect your laptop with your phone via hotspot (or any local network)
  3. Start Desktop app
  4. Enter connection details shown on Desktop
  5. Tested on Android 4.2.2 (Samsung Duos)

Screenshots

Live Screen Connection Screen
Touchpad Screen Navigation Screen
Typing Screen Media Player Screen
Image Viewer Screen File Transfer Screen
Presentation Screen Power Off Screen
Downloading File Screen Music Control Screen
Desktop App Desktop Image Viewer

How to contribute?

Desktop part of this project has been developed in Netbeans(Java-FXML) while that of Android part in Android-Studio.

Steps to deploy app on your machine-

  1. There are three folders-
    1. RemoteControlPC-Studio- Android part, Import in Android Studio
    2. RemoteControlPC-JavaFXML- Desktop part, Import in Netbeans (Use SceneBuilder)
    3. RemoteControlPC-Libraries- Libraries (Jar file) that is being used in android as well as desktop, Import in Netbeans
  2. Library has a dist folder that contains jar file.
  3. Add this jar file in build path of Desktop (Netbeans) as well as Android part. See steps below.
  4. To change/modify the java files inside library folder, import it in Netbeans and 'clean and build project' after changing.
  5. Make sure to clean android as well as desktop part after modifying library files.

Steps to add jar file to android as well as dekstop part-

  1. For Netbeans-
    1. Right click on project
    2. Click Properties
    3. Click Libraries
    4. Add JAR/Folder -> Select jar from /path/to/repository/RemoteControlPC-Libraries/dist/RemoteControlPC-Libraries.jar

To see working demo on youtube watch this video:

Testing of android app:

  • Android 4.2.2 Samsung(GT-S7582)
  • Android 6.0.1 Redmi 4A
  • Android 5, API 22 (Emulator)
  • Android 7, API 24 (Emulator)

Releases:

For query/issues open Github issue or contact: [email protected]

remote-control-pc's People

Contributors

anshulkhattar avatar razz2 avatar varunon9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

remote-control-pc's Issues

TextView not working when I changing activity .

I want to add a message option to send message from server to client with this project.

I have two Activities: MainActivity and SecondActivity. On MainActivity I click on a button and go to SecondActivity.

public void msg(View view) {
    Intent intent = new Intent(this, secondActivity.class);;
    startActivity(intent);
}

SecondActivity

 public class SecondActivity extends AppCompatActivity {

   private TextView info;

  @Override
  protected void onCreate(Bundle savedInstanceState) {

     super.onCreate(savedInstanceState);
     setContentView(R.layout.activity_SecondActivity);
   
     info = findViewById(R.id.terv);


     new Thread(new Te()).start();

  }

  private class Te implements Runnable {
    @Override
    public void run() {
        while (true) {
            try {                 
                final String message = (String) MainActivity.objectInputStream.readObject();
                if (message != null) {
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            info.append(message);
                        }
                    });
                }
        } catch (IOException | ClassNotFoundException e) {
                e.printStackTrace();
            }
         }
   }
 }
 }

The TextView works smoothly and shows the message when opening the SecondActivity for the first time.

But for the second time, when I go back to MainActivity and open the SecondActivity, the TextView doesn't work.

How can I solve this?

Problem

I have errors in Netbeans and Eclipse too ( i prefer switch to android studio ) need video describe how to import project and run it ..

Touchpad issue

Hi, i've got a problem with touchpad. It works really slowly, it looks like it has delays.
Tried to modify it, for example by changing coordinate type to float from int but it didn't help.
I want the cursor to move smoothly.
Can you help me?
Regards

Android 7.1.2 + Arch Linux: "connection closed" immediately after successfully connected

PROBLEM
After the connection is successfully established it's closed immediately. A few tons of "Connection closed" toasts are displayed (just flickering around until I kill the app). Java drops 2 exceptions.

  • NETWORK
    • Fritz!Box
    • all decives use Wifi
  • SERVER
    • HP EliteBook 820 G1
    • Antergos OS (Arch Linux) - it's rolling release, so it should have "latest" versions
    • GNOME
    • Basic installation (nothing tweaked or modified)
    • Java-Version:
$ java -version
java version "1.7.0_131"
OpenJDK Runtime Environment (IcedTea 2.6.9) (Arch Linux build 7.u131_2.6.9-1-x86_64)
OpenJDK 64-Bit Server VM (build 24.131-b00, mixed mode)
  • CLIENT
    • Nexus 5X
    • Android 7.1.2 (beta ring, patches applied 2017-05-05 18:00)
    • not rooted
    • App Version 1.0 from F-DROID Store

DETAILS
After starting the JAR (tested it with user rights and sudo) there is an initial Exception:

Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedClassVersionError: javafx/embed/swing/JFXPanel : Unsupported major.minor version 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	at remotecontrolpc.desktop.MainScreen$3.run(MainScreen.java:204)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:745)
	at java.awt.EventQueue.access$300(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:706)
	at java.awt.EventQueue$3.run(EventQueue.java:704)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:715)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:218)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:133)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:122)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:118)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:110)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

The server windows opens, shows the correct IP address and port opened. It even states the correct connection once I connect the app. As long as I stay on the prefs page nothing happenes. As soon as I switch to touchpad and touch anything, the toast "Connection closed" appears. The server app still shows "Connected to: /192......", and there is another Exception:

Exception in thread "Thread-0" java.lang.UnsupportedClassVersionError: javafx/beans/value/ObservableValue : Unsupported major.minor version 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	at remotecontrolpc.desktop.server.Server.connect(Server.java:42)
	at remotecontrolpc.desktop.MainScreen$4.run(MainScreen.java:244)

Clicking "File Transfer" simply crashes the app. That might have to do with the lost connection...

Since the only thing I know about Java is that it's getting better after appending "Script" to it, my information might not be enough to debug. ;-)

I also have the logcat output of my last try (I didn't clean up anything. Lines 25-154 are "dups"): https://gist.github.com/boppy/39e981ae651b887de0fd5949ac0608e4

Any ideas on what I'm doing wrong?

Server not found

when I am trying to connect it gives an error server port is not listening, how to resolve it?

only LiveScreen is working

i could establish a connection but the only working part of the app is the LiveScreen feature...
the PC Aplication tells me i am Connected to the app and the LiveScreen feature proves that, but i can not control the mouse or the keyboard of my notebook...

How to lock , shutdown , restart and suspend the pc with runtime.exec in java ?

How to lock , shutdown , restart and suspend the pc with runtime.exec in java ?

I want to make a jar for windows and linux os.

I want to lock , shutdown , restart and suspend the pc programmatically.

I tried this code.

package poweroff;

import mousekeyboardcontrol.MouseKeyboardControl;


public class PowerOff {
String os;
Runtime runtime;
public PowerOff() {
    os = System.getProperty("os.name");
    runtime = Runtime.getRuntime();
}

public void shutdown() {     
    try {
        if ("Windows 8.1".equals(os) || "Windows 8.0".equals(os) || "Windows 10".equals(os)) {
            runtime.exec("shutdown -s");
        } else {
            System.out.println("Unsupported operating system");
        }
    } catch(Exception e) {
        System.out.println("shutdown error");
        e.printStackTrace();
    }
    
}

public void restart() {     
    try {
        if ("Windows 8.1".equals(os) || "Windows 8.0".equals(os) || "Windows 10".equals(os)) {
            runtime.exec("shutdown -r");
        } else {
            System.out.println("Unsupported operating system");
        }
    } catch(Exception e) {
        System.out.println("restart error");
        e.printStackTrace();
    }
    
}

public void suspend() {     
    try {
        if ("Windows 8.1".equals(os) || "Windows 8.0".equals(os) || "Windows 10".equals(os)) {
            runtime.exec("Rundll32.exe powrprof.dll,SetSuspendState Sleep");
        } else {
            System.out.println("Unsupported operating system");
        }
    } catch(Exception e) {
        System.out.println("suspend error");
        e.printStackTrace();
    }   
}

public void lock() {     
    try {
        if ("Linux".equals(os) || "Mac OS X".equals(os)) {
            new MouseKeyboardControl().ctrlAltL();
        } else if ("Windows 8.1".equals(os) || "Windows 8.0".equals(os) || "Windows 10".equals(os)) {
            runtime.exec("Rundll32.exe user32.dll,LockWorkStation");
        } else {
            System.out.println("Unsupported operating system");
        }
    } catch(Exception e) {
        System.out.println("pc lock error");
        e.printStackTrace();
    }
    
}

public static void main(String args[]) {
    PowerOff powerOff = new PowerOff();
    powerOff.lock();
}
}

But , it not worked.

I want to lock , shutdown , restart and suspend with programmatically in java for windows 7 , 8 ,10 and all linux os.

How Can I solve this?

Connection Ends

The project works fine on BlueStacks Emulator but when running on a cellphone the connection ends with the following error messages at sever side when any remote feature is selected:

java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2601)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at remotecontrolpc.Server.connect(Server.java:73)
at remotecontrolpc.MainScreenController$1$1.call(MainScreenController.java:168)
at remotecontrolpc.MainScreenController$1$1.call(MainScreenController.java:164)
at javafx.concurrent.Task$TaskCallable.call(Task.java:1409)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at javafx.concurrent.Service.lambda$null$436(Service.java:718)
at javafx.concurrent.Service$$Lambda$80/219993391.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at javafx.concurrent.Service.lambda$executeTask$437(Service.java:717)
at javafx.concurrent.Service$$Lambda$78/1917189734.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Error:Failed to resolve: __local_jars__:G:\Workspace\StudioProject\RemortPc\app\libs\RemoteControlPC-Libraries.jar <a href="openFile:G:/Workspace/StudioProject/RemortPc/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

untitled

`apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "25.0.2"

defaultConfig {
    applicationId "com.example.remotecontrolpc"
    minSdkVersion 11
    targetSdkVersion 24
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}

}
dependencies {
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
androidTestCompile files('libs/RemoteControlPC-Libraries.jar')
compile 'local_jars:G:\Workspace\StudioProject\RemortPc\app\libs\RemoteControlPC-Libraries.jar:unspecified'
}`

how to connect to virtual box ?

I am using ubuntu on virtual box.

I want to transfer my files to ubuntu os.

the jar works on windows smoothly.

I runned the jar in ubuntu with virtual box. But , the IP address comes like this

 10.0.2.15 
 10.0.3.15

how can I connect ?

Is there any way to connect ?

Bug in Keyboard !!!

Error when I send the following characters

+×÷=/_€£₹₩!@#$%^&*()-'":;,?`~|<>{}[]°•○●□■♤♡◇♧☆▪︎¤《》¡¿

when I sent those it the connection disconnected.

Add media control

Hi,
I forked your app and modified it to include media controls (play, stop, next, previous, mute, volume up and down).
The problem I encountered is that java (or at least the Robot class) by default can't emulate key presses for special keys like the media keys. I therefore used the jnativehook library, which I found working just fine (tested on Windows only).
For the moment you need to import the library yourself (I think the GPL license of jnativehook isn't compatible with your MIT license).

Feel free to check my implementation and include it in your build or modify it as you like.

Kind regards

Application Crashes

Application gets terminated whenever I press the Live Screen displaying the following error on the server side.

java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2601)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at remotecontrolpc.desktop.server.Server.connect(Server.java:51)
at remotecontrolpc.desktop.MainScreen$4.run(MainScreen.java:244)
java.net.SocketException: Socket closed
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:116)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1877)
at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1786)
at java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:1286)
at java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1231)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1427)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
at java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:1577)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:351)
at remotecontrolpc.desktop.filesharing.Screenshot$1.run(Screenshot.java:39)

what is the purpose of 2nd ip address ?

I am a student. I want to learn about virtual box host-only network connection.

79231785-39e03800-7e84-11ea-9aeb-1bc1137a3697

1 St IP - LAN connection.

2 no IP - virtual box host-only network connection.

Usually I am using 1st IP if I connect with WiFi or mobile hotshot.

what is the purpose of 2nd ip address ?

Can you explain in detail ?

Firewall problem.

I created a remote controller android app as a Client and javafx app as a server.

I have one issue.

My javafx app works smoothly for some users.

But , the firewall did not allow the my app for some users.

How can I solve this problem?

I created a socket connection between javafx app and android app.

for some users the firewall did not allow my app.

How can I solve this ?

Wrong versionCode in latest release

Please remember to update versionCode and versionNumber when making a new release. The latest two APKs both identify themselves as:

package: name='com.example.remotecontrolpc' versionCode='1' versionName='1.0' platformBuildVersionName='6.0-2704002'

That way Android doesn't recognize the new version as being new, and won't accept it as "update". Just to let you know 😉

live screen can't show mouse pointer

hi,this project is usefull for me ,but when i use live screen has two problems
first:the mouse pointer can't show in the android devices ,do you know the reason?
second:the Screen picture of live screen can't change when the pc screen is changing
thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.