"capture.onResume()" not able to start camera preview.
See original GitHub issueHi @rkistner
If first time i allowed the camera permission, and in between if i deny the camera permission from “App info”, and if again i will start scanner and again allow the permission then the camera preview does not start immediately only red strip blinking; for camera preview i have to start my activity again (and i’m not finishing my activity on positive button click because i have manual barcode entry option too). Means user want it immediately start the camera preview as soon permission allowed, and there is a possibility that user may deny the camera permission anytime.
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults)
{
if(requestCode == cameraPermissionReqCode)
{
if(grantResults.length > 0 && grantResults[0] == 0)
{
capture.onResume();
}
else
{
displayFrameworkBugMessageAndExit();
}
}
}
private void displayFrameworkBugMessageAndExit()
{
Utils.displayInfoDialog(this, getString(R.string.scanner_error_title), getString(R.string.scanner_error_message), new DialogOnDoneCallback()
{
@Override
public void OnDone(Object onDone)
{
}
}, true);
}
Please look into this…Thanks in advance.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Camera Preview not visible after App Resumes - Stack Overflow
You create a CameraPreview only onCreate() of your Activity. But the camera instance is released onPause(), and a new one is opened onResume()....
Read more >Camera preview disappears after Fragment onPause ...
STEPS TO REPRODUCE: 1. Build and launch app attached 2. Swipe view pager right then left 3. Preview is gone. OBSERVED RESULTS: No...
Read more >Introduction to activities - Android Developers
An Activity is an application component that provides a screen with which users can interact in order to do something, such as dial...
Read more >Android Camera Preview App: Camera vs. Camera2
Create a new project with Empty Activity template. ... I want to make the code as simple as possible, so there is no...
Read more >CameraX Camera Leaks - Google Groups
if you need to change the orientation of imageAnalysis while onResume(), you can directly call imageAnalysis.setTargetRotation() to the existing ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rkistner @meierjan @cnworks Hi there i got its solution,
Its because, what we were doing capture.onResume(); we were calling on onResume() of activity and if permission is granted, its okay for library to initialize all camera instance but if the camera instance is not created (if user deny the permission) and we are trying to call capture.onPause(); on our activity’s onPause(). So that time there is nothing to pause. Thats it. So make sure before to call capture.onPause() that, Is camera is already initialized or not.
@rkistner @meierjan @cnworks Hi there i got its solution,
Its because, what we were doing capture.onResume(); we were calling on onResume() of activity and if permission is granted, its okay for library to initialize all camera instance but if the camera instance is not created (if user deny the permission) and we are trying to call capture.onPause(); on our activity’s onPause(). So that time there is nothing to pause. Thats it. So make sure before to call capture.onPause() that, Is camera is already initialized or not.