Robrowski / GeoSnap

Repository for my projects in CS 403x (Mobile and Ubiquitous) at WPI
1 stars 0 forks source link

Camera causes app crash when entered from notifications #8

Closed Robrowski closed 9 years ago

Robrowski commented 9 years ago

Circumstances:

  1. open app
  2. Hit the menu option to "Test Discovered Snaps Notification"
  3. Without closing the app (specifically don't leave MainActivity), click on the Notification

    What I know is happening:

  4. onPause is called in old fragment (currently owns camera)
  5. New activity starts up as per the intent in the notification
  6. New fragment attempts to start and claim camera
  7. CRASH
  8. Hypothetically, if it didn't crash, old fragment onDestroy gets called at the very end

    Why I haven't fixed it:

The solution is SUPPOSED to be releasing the camera in the "onPause" function (according to API), but the problem is onPause gets called other times too. Releasing effectively kills the mCamera object. Therefore, the camera gets RELEASED and gone, even though the surface view will be relying on that later. EX. turning your screen on then off freezes the camera.

If we can somehow restart/reinstantiate the SurfaceView used for the camera preview with the new camera object FROM the onResume of the CameraPreviewFragment, all issues solved.

Robrowski commented 9 years ago

https://github.com/pikanji/CameraPreviewSample/tree/master/src/net/pikanji/camerapreviewsample

mscosti commented 9 years ago

This is the same repository I used when for switching to dynamic image preview sizing, It's possible I didn't get everything quite right.

If this does not work, I bet we could go back to the version before dynamic previewing, since I started to notice a similar bug after implementing it, but it wasn't as consistent as this one. I would sometimes crash when after clicking a snap to go to snapview and then crash when going back to the list view.

Robrowski commented 9 years ago

its exactly that you didn't get all 100% of it right. I can explain later

Robrowski commented 9 years ago

Camera control stuff is fixed.

Just need to fix the size of the preview