Software Archive
Read-only legacy content
公告
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 讨论

QR Code Scan

Alexander_F_
新手
6,180 次查看

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 项奖励
16 回复数
Amrita_C_Intel
6,179 次查看

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 项奖励
Anusha_M_Intel1
6,180 次查看

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 项奖励
Alexander_F_
新手
6,180 次查看

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 项奖励
Hamilton_Tenório_da_
重要分销商 I
6,180 次查看

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 项奖励
Anusha_M_Intel1
6,180 次查看

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

0 项奖励
Hamilton_Tenório_da_
重要分销商 I
6,180 次查看

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 项奖励
Alexander_F_
新手
6,180 次查看

I am using Intel XDK Scan Plugin

0 项奖励
Hamilton_Tenório_da_
重要分销商 I
6,180 次查看

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

0 项奖励
Alexander_F_
新手
6,180 次查看
0 项奖励
Hamilton_Tenório_da_
重要分销商 I
6,180 次查看

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

0 项奖励
Alexander_F_
新手
6,180 次查看

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 项奖励
Amrita_C_Intel
6,180 次查看
0 项奖励
Alexander_F_
新手
6,180 次查看

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 项奖励
PaulF_IntelCorp
6,180 次查看

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 项奖励
John_R_5
初学者
6,180 次查看

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 项奖励
Hamilton_Tenório_da_
重要分销商 I
6,180 次查看

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

0 项奖励
回复