I am having an issue with using the SampleCamActivity (from the demos) with standard Android TextToSpeech and opening a new activity that uses the camera. As soon as the second activity calls camera.open(), I see the error "CameraBase - An error occurred while connecting to camera: 0" and "Camera failed to open" and "Fail to connect to camera service."
This only happens when I use TextToSpeech. It seems like the wikitude SDK is not properly releasing the camera when the SampleCamActivity is paused, but I don't see anything in the logs that shows anything is failing when the SampleCamActivity is paused.
Has anyone else ran into this?
about 6 years ago
Please check implementation of your custom Activity. I just tested camera states by switching between native camera application and sdk samples app without any issues. Have you tried restarting your device and check if native Camera app works the way it should?
Even launchin an ArchitectActivity from another activity works without any issues (compare Wikitude application).
Please test using system's camera intents (as in Camera API docs) and let me know if issue still occurs. If it works for those it might be an issue in your custom camera Activity.
Hope that helps
about 6 years ago
I have restarted my devices and the error still occurs. I also started the standard camera app using intents and it also failed aslong as TextToSpeech was being used.
One thing I should have included in the original message was that I am using the Vuzix SDK, and I wanted to make it a point that this only occurs when I use android.speech.tts.TextToSpeech. Also, this occurs both when running on the Vuzix M100 and when running on a Samsung Galaxy S4.
I have attached the files I changed. Basically I added a button to the "Image On Target" screen and when you click it, it will open the standard android camera through an intent. The files include:
-srccom\wikitude\samples\SampleCamActivity.java -src\com\wikitude\samples\VuzixCameraTestActivity.java (Not currently called, but can uncomment lines in SampleCamActivity to start this activity) -assets\samples\1_Image$Recognition_1_Image$On$Target\index.html
In SampleCamActivity, if you comment out the following lines, then the camera will open without issue on the second activity, but if you run as-is, it will fail.