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);
}
链接已复制
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:
- github.com/yoik/cordova-yoik-screenorientation.git
- github.com/yoik/cordova-yoik-screenorientation.git#06b93e6
The second reference provides the git commit referenced here (we do not support pulling from the PhoneGap registry).
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.
Here is the problem when I added third party plugin to my project I get this message and the build process is interrupted
- 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.
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.
