Reputation: 137
Hi I'm very new to android and I just shift my work form iOS so I don't know much about android.
I want to create the android device screen monitoring app. Which can see other android device screen simultaneously over WiFi and also can broadcast screen to other device.
I think of using UDP to broadcast screen by simply capturing screen and send it to host. It's no need to be real time just show what's on their screen would be suffice.
By call this method with timer
private void captureScreen() {
final View rootview1 = findViewById(R.id.root).getRootView();
rootview1.setDrawingCacheEnabled(true);
Bitmap bmp = rootview1.getDrawingCache();
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.JPEG, 20, bytes);//lower quality faster
byte[] byteArray = bytes.toByteArray();
packetToSend.setData(byteArray);//send image
rootview1.setDrawingCacheEnabled(false);
}
Now I can send view of my app and show on the host properly.
My problem is if I run this method as service how do I find the current view while they open other application (like Browser, games, movie) or in dashboard?
please help
Thanks.
Upvotes: 0
Views: 483
Reputation: 1006664
My problem is if I run this method as service how do I find the current view while they open other application (like Browser, games, movie) or in dashboard?
Fortunately, this is not possible, for blindingly obvious privacy and security reasons. You are welcome to share your own UI that way (per your code); you cannot share other apps' UI that way.
There are various options available for use on rooted devices, though I have lost track for how well they work given recent changes to the Android UI pipeline.
Upvotes: 1