Display Android Sharing on Other Devices

I am working on distributing a tablet screen with more than one table (all root) connected via WiFi, I use the following approach (all inside one stream):

1- take a screenshot.

Process sh = Runtime.getRuntime().exec("su", null,null); OutputStream os = sh.getOutputStream(); os.write(("/system/bin/screencap -P " + "/sdcard/test/img.png").getBytes("ASCII")); os.flush(); os.close(); sh.waitFor(); 

2- compress the screen image.

 Bitmap mBitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory().getPath() + "/test/img.png"); OutputStream outputStream = null; File file = new File(Environment.getExternalStorageDirectory().getPath() + "/test/img2.png"); outputStream = new FileOutputStream(file); mBitmap.compress(Bitmap.CompressFormat.JPEG, 15, outputStream); outputStream.flush(); outputStream.close(); 

3- open socket and send the compressed image to another tablet.

this works, but my problem is delayed viewing on another tablet, it took 4-5 seconds to update the new display, is there a better approach to real-time display?

+7
source share
1 answer

Unfortunately, this feature will take a long time. It is associated with the process life cycle, IPC, and slow file system. You need to take a look at this library or the source code / system / bin / screenshot util. You need to reuse your own (c-language) functions from sources, and this is not a trivial task.

+3
source

All Articles