cancel
Showing results for 
Search instead for 
Did you mean: 

scanning barcode using andriod tablet camera using cordova plugin

former_member200679
Participant
0 Kudos

Hi,

I am using an andriod tablet.

i have used cordova plugin in sap fiori client to scan barcode using tablets camera. The camera is opening in landscape mode, is it possible to open camera in potrait mode?

i have used this link for coding reference :

http://help.sap.com/saphelp_smp306sdk/helpdata/en/45/e53e1ee3f64263ad8537c8b5462ace/content.htm?fram...

Please reply as soon as possible.

Thanks,

Saurabh.

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member200679
Participant
0 Kudos

I am relying on SAP Fiori client for cordova plugins. SAP Fiori client version is 1.6.5. It seems that the SAP Fiori client is not supporting the above mentioned code to change orientation of camera for scanning a barcode.

Now i am trying to add cordova plugins in my webcontent folder.

Is there a link where i can directly copy existing cordova plugins js files into my exisiting ui5 apllication instead of creating it from scratch?

Please advise.

Thanks,

Saurabh.

Ryan-Crosby
Active Contributor
0 Kudos

Hi Saurabh,

From a command line prompt when you are inside a Cordova project you would simply execute two lines of code:

cordova plugin remove kapsel-plugin-barcodescanner

cordova plugin add new_plugin (whatever one you choose)

You'd have to remove the Kapsel plugin because you won't be able to build the project with another bar code scanner installed along with that.

Regards,

Ryan Crosby

venkatachala_ck
Active Participant
0 Kudos

Hi Saurabh,

Check out this link

Thanks & Regards

Venkat

former_member200679
Participant
0 Kudos

Hello Venkatachala,

I have gone through the link that you provided, but there is no mention of camera orientation configuration.

Thank you for the reply though.

Virinchy
Active Contributor
0 Kudos

HI Saurabh,

The Code snippet you are following is internally calling the Cordova barcode Scanner Plugin which i believe is forked from here .

You may see the configuration specified in the example of the same above link where orientation is supported and can be explicitly configured. It is also to be noted that the configuration only works for Android for now and not for other platforms .


{

   "preferFrontCamera" : true, // iOS and Android

   "showFlipCameraButton" : true, // iOS and Android

   "prompt" : "Place a barcode inside the scan area", // supported on Android only

   "formats" : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED

   "orientation" : "landscape" // Android only (portrait|landscape), default unset so it rotates with the device

  }

I highly recommend to use in landscape mode for barcode scanning , since the area to place the barcode image inside the rectangular scanning area is high and scans quickly when compared to portrait mode.

Regards

Virinchy

former_member200679
Participant
0 Kudos

I am using Cordova plugin to perform scanning operation which works fine in SAP Fiori client in tablet(No need to install plugins explicitly). I have already tried adding the above mentioned config object to the existing cordova function but the app is not reading it. In place of landscape orientation , i had added portrait. The camera is still opening in landscape mode.

Is there another way to change orientation or do i need to add another config details apart from above mentioned code?

Ryan-Crosby
Active Contributor
0 Kudos

Hi Saurabh,

You have used the Kapsel bar code scanner or some other plugin?  There is a way to lock it into portrait mode when the camera is opened but you have to alter the manifest.xml and I'm not sure you have access to that with the Kapsel plugin.

Regards,

Ryan Crosby