Software Archive
Read-only legacy content

QR Code Scan

Alexander_F_
Novice
6,096 Views

When I try to scan a QRCode with Android devices QR code screen automatically flips to horizontal, any help to keep the screen in portrait orientation and rotate only if I rotate the phone.

        document.addEventListener("intel.xdk.device.barcode.scan", barcodeScanned, false);
        try{
            intel.xdk.device.scanBarcode();
        }
        catch(error){
            alert(error.message);
        }

 

0 Kudos
16 Replies
Amrita_C_Intel
Employee
6,095 Views

If you are using Cordova* 3.X build options (Crosswalk* for Android*, Android*, iOS*, etc.), you can set the orientation under the Projects panel > Select your project > Cordova* 3.X Hybrid Mobile App Settings - Build Settings. Under the Build Settings, you can set the Orientation for your desired mobile platform.  

If you are using the Legacy Hybrid Mobile App Platform build options (Android*, iOS* Ad Hoc, etc.), you can set the orientation under the Build tab > Legacy Hybrid Mobile App Platforms Category- <desired_mobile_platform> - Step 2 Assets tab. 

[iPad] Create a plugin (directory with one file) that only has a config xml that includes the following: 

<config-file target="*-Info.plist" parent="UISupportedInterfaceOrientations~ipad" overwrite="true">

        <string></string>

</config-file>       

<config-file target="*-Info.plist" parent="UISupportedInterfaceOrientations~ipad" overwrite="true">

   <array>

<string>UIInterfaceOrientationPortrait</string>
    </array>

</config-file>

 

Add the plugin on the build settings page. 

Alternatively, you can use this plugin: https://github.com/yoik/cordova-yoik-screenorientation. You can import it as a third-party Cordova* plugin using the Cordova* registry notation:

  • net.yoik.cordova.plugins.screenorientation (includes latest version at the time of the build)
  • net.yoik.cordova.plugins.screenorientation@1.3.2 (specifies a version)

Or, you can reference it directly from the GitHub repo: 

The second reference provides the git commit referenced here (we do not support pulling from the PhoneGap registry).

0 Kudos
Anusha_M_Intel1
Employee
6,096 Views

Hi Alexander,

I am positive the Intel XDK plugin does not supports device orientation changes. I would like to prompt you to use the Cordova plugin but I see that you have already been advised to do so in previous posts. 

Intel XDK plugins are no longer maintained. So you will benefit from switching over. 

0 Kudos
Alexander_F_
Novice
6,096 Views

Can you provide me an example of Cordova Plugin Scan because I tested all the examples I found and doesn't work for me.

0 Kudos
Hamilton_Tenório_da_
Valued Contributor I
6,096 Views

You can see an APP working with it, build with Cordova Android.

Install https://play.google.com/store/apps/details?id=com.hamiltonhtsnet.com.br.confirmakiPro

After, tap "Fazer download de novo evento", tap the icon of a QR Code and scan the image attached. It works good!

0 Kudos
Anusha_M_Intel1
Employee
6,096 Views

@Hamilton. Is this with Cordova or Intel XDK Plugin?

0 Kudos
Hamilton_Tenório_da_
Valued Contributor I
6,096 Views

I made this APP using Intel XDK and build with Cordova Android. In the past, it was only Android. In the last month I publish a new version (Cordova) with the same plugin (QR Code).

0 Kudos
Alexander_F_
Novice
6,096 Views

I am using Intel XDK Scan Plugin

0 Kudos
Hamilton_Tenório_da_
Valued Contributor I
6,096 Views

ah, i forgot, the plugin is https://github.com/wildabeast/BarcodeScanner

0 Kudos
Alexander_F_
Novice
6,096 Views
0 Kudos
Hamilton_Tenório_da_
Valued Contributor I
6,096 Views

@Alexander> This one I didn´t use/test yet.

0 Kudos
Alexander_F_
Novice
6,096 Views

Here is the problem when I added third party plugin to my project I get this message and the build process is interrupted

The build failed.
An error occurred while building the application. Verify your build assets are correct and try again.
Build Log:
  • Building a Cordova 4.1.2 application.
  • The application name is "Biipit"
  • The package name is "com.alexanderfleites.biipit"
  • Plugin "org.apache.cordova.device" (0.2.13) installed.
  • Plugin "org.apache.cordova.dialogs" (0.2.11) installed.
  • Plugin "com.phonegap.plugins.facebookconnect" (0.10.1) installed.
  • Plugin "nl.x-services.plugins.socialsharing" (4.3.19-dev) installed.
  • Plugin "com.intel.xdk.device" (1.0.7) installed.
  • Plugin "org.apache.cordova.splashscreen" (0.3.5) installed.
0 Kudos
Amrita_C_Intel
Employee
6,096 Views
0 Kudos
Alexander_F_
Novice
6,096 Views

The second one, because hen you enter in the first one said that this plugin is deprecated and you need to use the other.

0 Kudos
PaulF_IntelCorp
Employee
6,096 Views

If you remove the reference to the barcode plugin does the build succeed? Also, are you referencing it using the ID or the github repo address? I notice that it has been converted to the new Cordova CLI 5.x format (see the ID inside the plugin.xml file in the repo) and that might be causing some trouble. It does not appear to have any dependencies, so you should be able to retrieve it successfully from the git repo. Here's the git address you would use to do that:

https://github.com/phonegap/phonegap-plugin-barcodescanner.git

This will give you the latest version. To specify a specific version from the repo you need a "git ref tag" -- which this one has in spades. In that case, to specifically retrieve version 2.20 you would specify the plugin this way:

https://github.com/phonegap/phonegap-plugin-barcodescanner.git#2.20

To specify the current latest version, specifically, you would do this:

https://github.com/phonegap/phonegap-plugin-barcodescanner.git#v3.1.2

Note that the format of the git ref tag depends on the repo tags, it can be anything. See the "Tags" list under the "branch: master" pulldown in the upper left of the repo file list.

0 Kudos
John_R_5
Beginner
6,096 Views

Hello

Someone have a QR example that run and I can download to add in a new proyect. I need read QR and barcode in IOS and Android app.

Thanks.

0 Kudos
Hamilton_Tenório_da_
Valued Contributor I
6,096 Views

I am using https://github.com/wildabeast/BarcodeScanner.

0 Kudos
Reply