I want to share my device screen on server and remotely access it from server. I have tried many ways like: MediaProjection , setDrawingCacheEnabled(true).
In case of MediaProjection i get to know that we have to pass a surface and it will draw the whole screen in that surface. But i want to fetch a drawable or bitmap from that surface which i can share and also handle click from server, which will reflect on my android device(just like teamviewer do):
MediaProjection :
VirtualDisplay mVirtualDisplay = mMediaProjection.createVirtualDisplay("ScreenCapture",
mSurfaceView.getWidth(), mSurfaceView.getHeight(), mScreenDensity,
DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
mSurfaceView.getHolder().getSurface()
, null, null);
But using VirtualDisplay or Surface, i am not able to share this on server. Is there any other way to capture screen continuously and share it on server.
setDrawingCacheEnabled(true) :
View view = getView().getRootView();
view.setDrawingCacheEnabled(true);
view.buildDrawingCache(true);
Bitmap b = Bitmap.createBitmap(view.getDrawingCache());
but the problem with this is, that i can not capture the screen outside my application i.e. i don't have access to the parent view on which other views are rendered.
Also if i get access to the parent of all the views but, it will not recursively draw the content of its child.
My overall question is Any way to capture the screen(outside my application), share it on server and handle the click?