我創建了一個在其他應用上運行的服務。我希望服務能夠在用戶看到整個屏幕時截取屏幕截圖,而不管正在運行什麼應用。我可以讓該服務運行手機的屏幕截圖功能並將其存儲在特定位置嗎?在Android中從服務中獲取屏幕截圖
0
A
回答
3
我可以讓服務運行手機的屏幕截圖功能並將其存儲在特定位置嗎?
否,除了可能在根植設備上,出於明顯的隱私和安全原因。
0
好,類似的問題一直非常受歡迎的計算器:
How to programmatically take a screenshot in Android?
How to take screenshot programmatically?
how to take screenshot programmatically and save it on gallery?
特別是,這個人是有用的:
// image naming and path to include sd card appending name you choose for file
String mPath = Environment.getExternalStorageDirectory().toString() + "/" +
ACCUWX.IMAGE_APPEND;
// create bitmap screen capture
Bitmap bitmap;
View v1 = mCurrentUrlMask.getRootView();
v1.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
v1.setDrawingCacheEnabled(false);
OutputStream fout = null;
imageFile = new File(mPath);
try {
fout = new FileOutputStream(imageFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fout);
fout.flush();
fout.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
由Mualig,從上面的帖子之一。
相關問題
- 1. Windows服務無法在Windows 7中獲取屏幕截圖
- 2. 在Rails中截取屏幕截圖
- 3. ffmpeg獲取屏幕截圖
- 4. 在大屏幕截圖中獲取小屏幕截圖位置的座標
- 5. 從browserstack獲取屏幕截圖
- 6. 從LinearLayout獲取屏幕截圖
- 7. 從WPF獲取屏幕截圖
- 8. 如何從videofile獲取屏幕截圖?
- 9. 在Android中使用移動圖像截取屏幕截圖
- 10. 爲什麼從framebuffer獲取屏幕截圖在android上很慢?
- 11. android屏幕截圖
- 12. Android Open WebView後臺服務和捕獲屏幕截圖
- 13. 如何在沒有root的Android 2.3.3中截取屏幕截圖?
- 14. 無法在Android模擬器中截取屏幕截圖
- 15. 如何使用CameraView在Android中截取屏幕截圖(SurfaceView)
- 16. C++截取屏幕截圖
- 17. 截取屏幕截圖
- 18. 從無服務器的服務中捕獲整個android屏幕
- 19. 執行程序從Windows服務捕獲屏幕截圖
- 20. 在硒中捕獲屏幕截圖
- 21. 從服務中獲取媒體播放器服務屏幕
- 22. 如何獲取屏幕截圖圖片
- 23. Android:從服務中喚醒屏幕
- 24. 如何從FMed中的TMediaPlayerControl獲取屏幕截圖?
- 25. 如何從mapview中獲取屏幕截圖
- 26. 從Max OSX的屏幕(截圖)中獲取像素
- 27. SpriteKit屏幕截圖的屏幕截圖
- 28. 如何從RemoteWebDriver服務器獲取屏幕截圖而不是本地FirefoxDriver?
- 29. PHP中的Android屏幕截圖
- 30. android中的屏幕截圖功能
據我所知,這是無法完成的。您只能截取您應用中的內容。 –