I'm working for few weeks with Vuforia,unity and Android in one package and i a bit stuck on one problem. I manage to almost finish all parts of my application besides one.
Because i run some videos, I had to implement another activities besides main camera one, to show them there. I manage to start video, and everything is working like charm up to point when i'm getting back to main camera activity, problem is - camera is black and object is not visibile. I tried to resume or restart whole window again using resume methods and getting focus request on unityPlayer no luck though.
One thing which is even more confusing for me is, clicking app stac in android (icon which is showing all runing apps), and getting back from there is making camera work again, same thing with clicking home button.
Any ideas how i can make camera work after activity is resumed?
Marek
edit: I notice that turning of screen works too.
Related
I'm running into an issue and I would appreciate some guidance. I'm writing a small Android program in Android Studio that uses MediaProjection to grab a screenshot of the whole screen and then I want to pass that screenshot as a Bitmap to my System Overlay (based on the chatheads example). When the MediaProjection runs and the Imagereader creates the bitmaps, I'm passing the bitmap into a class global variable so I can pass it into my System Overlay service and display it. The problem I'm running into is if I "tab out" to a different app, my methods stop working from the MainActivity. When my app is in focus, everything works well, when a different app is focused, the system overlay contracts and expands like it should, but the screenshots are not being taken anymore. My understand is its because my app becomes "asleep" since it's not in focus. Could anyone recommend a solution? Can I momentarily awake my mainActivity so it can take a screenshot? Can I keep my activity from falling asleep on app switch? Can I bring focus to my app, take the screenshot and then switch focus to the previous app? Any other ways?
My code can be found here: https://github.com/asheron21/FacebookLikeChathead
MainActivity:https://github.com/asheron21/FacebookLikeChathead/blob/master/app/src/main/java/com/example/chatheads/MainActivity.java
Service: https://github.com/asheron21/FacebookLikeChathead/blob/master/app/src/main/java/com/example/chatheads/ChatHeadService.java
Global Variables:https://github.com/asheron21/FacebookLikeChathead/blob/master/app/src/main/java/com/example/chatheads/Globals.java
Thanks!
Is there any way to play the same background video in all activities? (preferably not to restart when opening a new activity)
Some methods from here: Integrating video file in android app as app background kinda works, but only in one activity. For example, if I go from my main activity into another, when I come back some elements from my .xml file fails to visible load. In fact, the buttons are still there if I press where they should be, it works, but they are not visible.
I am working on a camera implementation similar to what Snapchat offers.
I have created a subclass of SimpleCameraHost to customize the directories and file paths and to handle saveImage(I am cropping the image into a square before I save it to disk). I have also subclassed CameraFragment as you(Mark) have in the demo.
I need to take three pictures(Take pic...user okays it...Move onto second pic..repeat...) before I continue with the flow of the app. I am using the single shot mode. In the Oncreate() of the DemoFragment
SimpleCameraHost.Builder builder =
new SimpleCameraHost.Builder(new MyCameraHost(getActivity(), useFFC));
setHost(builder.useSingleShotMode(true).build());
Question : I need to know how to prevent the cameraview from restarting
the camera every time I pause the app while I'm on the 'okay the pic page'
and resume.Also if I leave the app idle on this page for a while, it seems to freeze and my camera cannot be started again(from any camera app including the default...I have to restart the device). I reckon this happens because I have not released the camera. Could you please direct me as to how I should handle pausing and resuming the app.
I need to know how to prevent the cameraview from restarting the camera every time I pause the app while I'm on the 'okay the pic page' and resume
In the demo app, if I switch to single-shot mode, take a landscape picture using the rear-facing camera, press HOME from the photo-preview screen, return to the app from the recent-tasks list, and press BACK, everything behaves fine, at least on the Nexus 4 that I just tried it on.
Hence, I would suggest that you compare your app to the demo app and see where things differ that might cause this behavior.
If you feel that there is a bug in the library, feel free to file an issue, but you would need to give me a complete set of materials to be able to reproduce the problem. That would include details of the device (e.g., Build.PRODUCT), the code to reproduce it (if it is not one of the demo apps), and the steps I should manually follow to reproduce it.
Also if I leave the app idle on this page for a while, it seems to freeze and my camera cannot be started again(from any camera app including the default...I have to restart the device)
Once again, I cannot reproduce this behavior. Immediately following the steps that I outlined above, I took another picture in single-shot mode, and left the app on the photo-preview screen while I composed the first part of this answer. I just pressed BACK, and everything is normal. So, again:
Compare your app to the demo app, to see if you can determine what you may be doing that might cause this effect
File an issue if you think that it is a bug in the library, but only do so if you can give me steps to reproduce the bug
how is it possible to show an image ontop of a running activity while still being able to control the background?
in case some ppl say it is not possible, check this app out:
https://play.google.com/store/apps/details?id=com.myboyfriendisageek.stickit&hl=en
is there a way to open a transparent activity but still being able to control the previous activity?
ive also tried using a toast, but that is capped by a timer, and i have not been able to find a way to control it.
I have a tabHost with three activities, one of them is meant for taking pictures and uses the android camera. When I click on this tab for the first time, a blank screen appears for 1-2 seconds before the tabs reappear and the camera preview starts. Is there a way to reduce the delay or at least let the tabs stay while the camera is opened. I tried initialising the camera in a separate thread, but it gave me a runtime exception.
As I understand, you are starting the Camera intent from your application, or are you just displaying a preview of the Camera feed right on your app? Providing code with your question will help you get better answers.
Are you having this problem on the emulator? If so, it's normal behavior and you shouldn't be worried. If this is on an actual device, I don't think you can really do anything about it. Try loading the Camera application by itself and compare times with your application, it shouldn't differ by much.
Ryan