admin管理员组文章数量:1394172
I am stuck into a problem programming an android application, using Java. I am implementing a Service, since my application should run in background, without affecting the other functionalities of the device.
I should access to camera device, I just need to grub the current camera frame within a given framerate. I am a bit confused, since it seems that I cannot access to camera without a view panel (and, since I am programming a service, I don't have a view panel).
I have tried different solutions found online, but no one of them works. I am using Andoird 6.0 (sdk 23). Do you have any hints?
------------ EDIT ------------------
Why should a service access to the camera?
I am working on a robotic system that is interfaced via a set of android API (the robot is composed of 2-layers. One is a standard computer that is not accessible, the other is the android layer with its API). Along with the APIs, the tablet has also different sensors, like a standard tablet camera.
I am developing an interface to get its sensors and make available the APIs via network, enabling the robot to be controlled without writing proper android applications on the robot. I have quite finished, and everything runs in a service, so the user will not lose the control of the robot tablet. However, I am not able to stream the camera data.
Regards,
I am stuck into a problem programming an android application, using Java. I am implementing a Service, since my application should run in background, without affecting the other functionalities of the device.
I should access to camera device, I just need to grub the current camera frame within a given framerate. I am a bit confused, since it seems that I cannot access to camera without a view panel (and, since I am programming a service, I don't have a view panel).
I have tried different solutions found online, but no one of them works. I am using Andoird 6.0 (sdk 23). Do you have any hints?
------------ EDIT ------------------
Why should a service access to the camera?
I am working on a robotic system that is interfaced via a set of android API (the robot is composed of 2-layers. One is a standard computer that is not accessible, the other is the android layer with its API). Along with the APIs, the tablet has also different sensors, like a standard tablet camera.
I am developing an interface to get its sensors and make available the APIs via network, enabling the robot to be controlled without writing proper android applications on the robot. I have quite finished, and everything runs in a service, so the user will not lose the control of the robot tablet. However, I am not able to stream the camera data.
Regards,
Share Improve this question edited Mar 15 at 7:35 Jonathan asked Mar 14 at 17:41 JonathanJonathan 213 bronze badges 3- Why a service should access the camera? Please describe your use case from end user point of view. – Livio Commented Mar 14 at 20:21
- Thanks, I added further info to my problem. – Jonathan Commented Mar 15 at 7:35
- I suggest to use only ImageCapture and start the camera using following statement: Camera camera = cameraProvider.bindToLifecycle(this, cameraSelector, imageCapture); – Livio Commented Mar 15 at 18:32
1 Answer
Reset to default 0Your approach seems to be technically infeasable. Unfortunately (because of security concerns) Android does not allow you to send a camera feed without a foreground application (You would be able to spy on people).
To make things easier, you could have a workaround that would make your setup significantly easier. Because you are using a Tablet you could start your App in a Splitscreen with the Robot App. People couldbe able to view your App (and you could display Robot Data) and you would be able to capture and send Camera Data. You could look here for a way of implementing the splitscreen!
本文标签: Access android device camera into a serviceStack Overflow
版权声明:本文标题:Access android device camera into a service - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744639216a2617016.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论