locked
Forcing camera to be in landscape and adding overlay RRS feed

  • Question

  • User138216 posted

    I have a Xamarin.Forms project targeting both iOS and Android (no WP8). I have a view that is used to take a picture of a check and upload that image, much like most banking apps. I need to do a few things that I can't seem to figure out:

    1.) How can I force the camera to be landscape mode (my USAA app does this, I believe Chase does as well)? 2.) How can I add an overlay, maybe a simple rectangle to help guide the user into capturing the entire check? 3.) Is there a way to force the camera resolution? My Galaxy S6 takes very large pictures by default (16M with 16:9 res) which creates a giant file and my API does not allow the POST to go through. I can absolutely change my API to allow it if necessary, but I would like to force the camera to use a smaller image size.

    I'm using the XLabs project found here.

    Wednesday, September 16, 2015 2:33 PM

All replies

  • User8854 posted

    This is a good question. @JJWilliams

    Try to open camera from a page and force the page to be landscape.

    Wednesday, September 16, 2015 10:41 PM
  • User138216 posted

    I'm using the XLabs project mentioned above, so I have set the MediaPickerActivity to be landscaped, but when it launches the camera, the camera defaults to whatever position the device is in. So if i'm holding it right side up, it is in Portrait, holding to the side, Landscape. I think this is expected behavior, as my Activity simply calls the Android Camera Activity and that launches. Is there a way when launching the camera to tell it to be in landscape? I don't know the Java API at all, so I'm not even sure where to start changing options for the native Camera Activity.

    Thursday, September 17, 2015 1:50 PM
  • User72189 posted

    @JJWilliams You should be able to set the Camera Activity to be in Landscape by defining the Activity Attributes. Something like below:

    [Activity(Label = "myApp", MainLauncher = true, Icon = "@drawable/Icon", ScreenOrientation = ScreenOrientation.Landscape)]

    I'm not familiar with the XLabs implementation, but you should be able to add an overlay fairly easy if you are in a new activity.

    You can't set what to take the picture with, i.e. 5MP or 10MP. What you can do though is take the BitMap created from the camera and then scale it to whatever size works for your application.

    Friday, September 25, 2015 12:21 AM
  • User138216 posted

    Unfortunately, putting my activity in landscape DOES turn my activity horizontal, but then the camera launches. When the camera launches it is in whichever position the device is facing. after snapping the picture, i return to my activity which is in landscape, but the camera itself is never forced into landscape. Is there anyway to force the CAMERA into landscape?

    Thanks for the resizing idea, that will definitely work for me!

    Tuesday, October 6, 2015 10:16 PM