RClone For Android

Hi everyone

Im currently working on an Android app for rclone.
The goal is to build an app with a basic ui to provide as many functions as possible of rclone.

My Background:

  • Have been working with Java/JavaEE a lot
  • Totally new to RClone
  • Quite new to Android
  • Quite new to handling Processes in Java
  • Estimated hours available to get the app running: 200h in the next 12 weeks

–> Yes it wont be easy :smiley:
So i will post my Question relating to rclone here (yes, it will may be more than just on or two)

Cheers

2 Likes

What’s done so far:

What I’m working on:
I’m currently coding a “Java Interface” for rclone:
Interface RClone: gives access to all rclone commands and options
Class RCloneImpl: Implements RClone
In the Future: Class RCloneHelper
Provides more high level functions as “CreateNewRemote”

My current Problem:
I can use rclone from termux just fine.
BUT: calling the config() method does not open a browser.

public void config(String... commands) throws IOException, InterruptedException {

        // commands: {"n", "name", "7", "", "", "y", "y"}
        Process process = exec("config");
        InputStream inputStream = process.getInputStream();
        OutputStream outputStream = process.getOutputStream();

        for (int i = 0; i < 6; i++) {
            String command = commands[i];
            wait(inputStream, 1);
            inputStream.skip(inputStream.available());
            outputStream.write((command + "\n").getBytes());
            outputStream.flush();
        }
        // yes i skip the last command, since it is not relevent until now for my current problem.
}

private void wait(InputStream inputStream, int threshold) throws InterruptedException, IOException {
        while (inputStream.available() < threshold) {
            Thread.sleep(200);
        }
        Thread.sleep(200);
}

It runs through without any exception and it writes just fine to my inputStream, but it does not open a browser.
Also when I open chrome myself and go to http://127.0.0.1:53682/auth, the page is not available.

Can someone please help me to get the authentication done.

Cheers

Hi guys

My Project has changed its focus a bit during the last weeks.
However, i managed to get my app running. It uses rclone in the background and works fine :slight_smile:

Give it a try if your interested:
https://play.google.com/store/apps/details?id=ch.ethz.idsc.unifiedcloudstorage

Cheers

1 Like

Wow - THX - Rclone for Android - how cool is that ! Will give it a try ! Thanks a lot !!!

Looks very interesting! How does it work? Does it shell out to rclone from java, or have you written it all in go?

Will the source be available?

Thanks

Nick

I use a binary which I compiled with Termux on my phone. This binary is then put into the assets of the app and shell out from java.

I put the code in a zip here (It’s not yet on github, maybe later):
https://drive.google.com/open?id=0B1j49WMCGBKEalJ6Ym1tWnRfbEU

Feel free to copy, publish, share, modify, do what ever you want with my code :smiley:

excellent ! good job ! :wink:

This is interesting. The only comment that I would make is to allow the user to optionally specify an alternative rclone binary to use (self-compiled) which you can store in the data of the app and use instead of the default one you provide. That would be VERY useful as I compile my own and sometimes we need a new beta for some things. What do you think?

Nice one!

BTW I make the lsjson command in the latest betas which you might find easier than scraping the output of ls and lsd.

1 Like

The binary is copied from to assets to the private files of the app. You can overwrite it with your own one.

Oh I will have a look at that :slight_smile: That will make my world simpler.

:slight_smile: thanks. Can you explain this a bit more? Without root on android I can’t replace the rclone asset unless I also compile my own android apk. Where would the file be located that I could replace it without root?

I wish i could get ENCFS and rclone to mount on my phone would make it easier to stream music to my car dash other than thru plex which seems to be music spotty.

Oh I assumed you have a rooted phone. Without root I don’t know if it is possible. But it will also cause problems, e.g. the dropbox authentication has changed and won’t work in the app with the new binary.

@ppseth Can you add it do the Third party integrations page on the wiki please?

Just did so :slight_smile:

Thanks for this! Does it work with encrypted cloud drives too?

SURE! Beauty of open source, the really “write once run it everywhere”.

1 Like

Is it possible to mount rclone or make the folder visible in other apps with this?