Giter Club home page Giter Club logo

Comments (7)

AndroidDeveloperLB avatar AndroidDeveloperLB commented on July 20, 2024

Why do you use root for this? It can be managed via the API, no?

from libsuperuser.

d4rken avatar d4rken commented on July 20, 2024

AFAIK sending CTRL-C is not possible.

There are other approaches though:
You can open as many shells as you want.
You can also modify the timeout values.

Also as @AndroidDeveloperLB mentioned there are API methods for taking pictures but this slightly depends on what you are trying to screenshot and API level you are aiming for.

from libsuperuser.

hendraanggrian avatar hendraanggrian commented on July 20, 2024

@AndroidDeveloperLB yes, you may record screen at API-level using MediaProjection API. The thing is, it's 5.0 or newer. So I have to use adb screenrecord to support older version of Android.

from libsuperuser.

hendraanggrian avatar hendraanggrian commented on July 20, 2024

@d4rken How do you open a new shell instance? I thought this library is supposed to be used with simple, single static instance like Shell.SU.run(String command).

from libsuperuser.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on July 20, 2024

@hendraanggrian I think this way:

        final AtomicReference<Shell.Interactive> rootSessionRef = new AtomicReference<>();
        rootSessionRef.set(new Shell.Builder().useSU().setWantSTDERR(true).setWatchdogTimeout(5).setMinimalLogging(true).open(//
                new Shell.OnCommandResultListener() {
                    @Override
                    public void onCommandResult(final int commandCode, final int exitCode, final List<String> output) {
                        final boolean success = exitCode == Shell.OnCommandResultListener.SHELL_RUNNING;
                        if (success)
                            _rootSession = rootSessionRef.get();
                    }
                }));

When you get to "sucess", you can use "_rootSession" .

from libsuperuser.

FaridBeiranvand avatar FaridBeiranvand commented on July 20, 2024

hi.i want to use 'adb shell screenrecord' command for video capturing with this library.what is the right way for use it?and my device is not root.can i use Shell.SU.run() for running this command?

from libsuperuser.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on July 20, 2024

@FaridBeiranvand For new questions, please create a new thread.
As for the question, if your device isn't rooted, this library cannot be used on it. It requires root.
However, Android already has an official API for screen recording, so you should use it instead of going to root solutions:
http://stackoverflow.com/q/32513379/878126

from libsuperuser.

Related Issues (20)

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.