I'm trying to use the Full Example given in:
http://docs.phonegap.com/en/3.3.0/cordova_camera_camera.md.html#camera.getPicture
I've created a project, added platform Android, added the Camera Plugin,
Then I've copied the example as is into index.html .
Ran it on an Android 4.3 device, I see an error in the Eclipse's console:
01-22 19:48:26.661: E/Web Console(22707): Uncaught TypeError: Cannot read property 'PictureSourceType' of undefined:19
(Yes onDeviceReady() is fired like it should)
What am I doing wrong ?
Thanks.
Try changing:
pictureSource=navigator.camera.PictureSourceType;
to:
pictureSource=navigator.camera.PictureSourceType.CAMERA;
If you use phongap build you have to add:
<gap:plugin name="org.apache.cordova.core.camera" />
to your config.xml no need cordova add plugin etc..
From what I've experienced with this camera plugin, sometimes the plugin won't expose the window.camera as is. Instead, try to access it through window.plugins, and if that doesn't work either, try using ngCordova with which you will be able to get it working faster.
You should also know that there are some bugs in Android which may crash the Android app.
Related
I have a Xamarin for Android app that has been working until today. I needed to make a change but before I did, I ran a test to ensure no VS or Nuget package updates caused an issue. I have Xamarin.Essentials in my app and this line worked before, not sure what is happening now.
if(DeviceInfo.Model == "TC72"){scannerIndex = 1;}
Exception Unhandled:
Xamarin.Essentials.NotImplementedInReferenceAssemblyException: 'This
functionality is not implemented in the portable version of this
assembly. You should reference the NuGet package from your main
application project in order to reference the platform-specific
implementation.'
Any insight would be helpful. TIA
I changed the DeviceInfo.Model to Build.Model and get the same info I was expecting. That fixed my issue. If anyone has a different suggestion, happy to entertain them.
Added 8/11/21 3:25pm CT
I also found that changing my Compile Target to 10.0 fixed the Xamarin.Essentials issues. So far the application is working on 8.1 on the device (Zebra MC3300).
Im building ionic 3 (angular5+es2015) application for android OS, it's working for android 7,8, and 9 but not for 6 version, and i got this error when startup application :
Any help please !
I think the issue is that the Javascript VM in Android 6 is too old to have support for arrow functions. The solution would be to use a transpiler like Babel to target the older VM, or to rewrite your code to remove uses of ES6 language features.
Edit: I'm sorry, I realized that there is a "Typescript" tag on this question. You might be able to adjust the target setting in tsconfig.json to output code that is compatible with the older Javascript version. Try using ES5, or if that does not work you can try ES3.
I've converted an Angular 5 project into Cordova project.
When I run cordova emulate browser, my application works great.
How ever, when I try to emulate it on Android or iOS it builds fine, but it fails within the application.
Android Error:
D/SystemWebChromeClient: file:///android_asset/www/vendor.2f2a0573c67e0d8a78d3.bundle.js: Line 1 : ERROR
I/chromium: [INFO:CONSOLE(1)] "ERROR", source: file:///android_asset/www/vendor.2f2a0573c67e0d8a78d3.bundle.js (1)
iOS Error:
NSURLConnection finished with error - code -1100
I noticed that if I remove
<script type="text/javascript" src="main.5bc80649598bbc3df9fa.bundle.js"></script>
There won't be any error, but my app obviously won't load since it's compiled JS is in that file.
What could be causing this problem? I'm sure that it's an issue in configuration or permissions, as the app works fine in browser.
On Android I tried adding
<preference name="loadUrlTimeoutValue" value="120000" />
to config.xml but it didn't give any improvement.
Your error (-1100) mean: NSURLErrorFileDoesNotExist
I think you try to get that file from wrong location.
Try to check path structure in generated filesystem assets or with web inspector and check if file is there:
file:///android_asset/www/vendor.2f2a0573c67e0d8a78d3.bundle.js
I am trying to wrap a SAPUI5 SplitApp application using cordova 3.4.0 and run it from an android device.
Initially, it gave a resources folder error, but have managed to resolve that too.
Now ,there is a new error that has cropped up. The error screenshot is attached here.
Error Uncaught ReferencError: sap is not defined at file:///android_asset/www/js/index.js
Regards,
Aaron D’C
I think sap ui libraries are not properly loaded.
Please check whether the resources properly configured in index.html or not. Check src entry in the following script tag
<script id='sap-ui-bootstrap'
src='resources/sap-ui-core.js'
data-sap-ui-theme='sap_bluecrystal'
data-sap-ui-libs='sap.ui.commons'></script>
While using the Phonegap platform I've ran in to a problem. When trying to access any of the device strings, e.g. device.name or device.platform, I get as value undefined. This occurs on both iOS and Android. I've set the permissions for Android in both the ApplicationManifest and the config.
While doing research into the problem i found that the problem could be the the device functionality will only be available after about 1 to 3 seconds. I've ran some test, set a timeout at 10 seconds or even perform the action manually via onClick at different times (up to several minutes), but i keep getting the undefined value.
I've tried window.device.name instead of device.name, same result.
Does anyone have a clue why this is happening?
Running Phonegap 2.3.0 on iOS 6.0.2 and Android 4.1.2
Code:
$('#deviceName').html('Name: ' + device.name);
$('#devicePlatform').html('Platform: ' + device.platform);
$('#devicePlatformVersion').html('Version: ' + device.version);
Full Code here
Your help is mush appreciated!
"WARNING: device.name is deprecated as of version 2.3.0. Use device.model instead."
Refer to the following: http://docs.phonegap.com/en/edge/cordova_device_device.md.html#device.name
Accessing the Feature
As of version 3.0, Cordova implements device-level APIs as plugins. Use the CLI's plugin command, described in The Command-Line Interface, to add or remove this feature for a project:
cordova plugin add org.apache.cordova.device
As found in the documentations here:
http://docs.phonegap.com/en/edge/cordova_device_device.md.html
or
https://github.com/apache/cordova-plugin-device/blob/master/doc/index.md
device.model might be what you want.
http://docs.phonegap.com/en/2.3.0/cordova_device_device.model.md.html