I'm using PhoneGap + jQuery Mobile for a new mobile app.
This plugin is used to call native contact view of Android so you don't have to inject contacts in HTML.
https://github.com/phonegap/phonegap-plugins/tree/master/Android/ContactView
I've followed the instructions properly but it doesn't work for me, whenever I try to run (after all the initialization routine) this JS on Android:
window.plugins.contactView.show(
function(contact) {
console.log(contact);
},
function(fail) {
console.log(fail);
}
);
It shows this error:
Error: Status=2 Message=Class not found
Can anyone help?
Note: I haven't used any PhoneGap plugin before.
http://simonmacdonald.blogspot.com/2011/05/installing-childbrowser-plugin-on.html
The issue has been described here in details.
Related
I am using Appery.io app builder and my app is JQM with v5.3 libraires version
I have to js code in click event and run in Android but not in iOS.
I tried this and the same result. Anything argument in window.open run in Andorid but not in IOS (mail, https…).
window.open("tel:+34607507097");
window.location.href = 'tel:+34607507097';
Any suggestions . Thanks
Could I ask you to check if the in-app browser is enabled under App settings > Cordova Plugins and then check out this code:
if (window.cordova) {
cordova.InAppBrowser.open("tel:+34607507097", '_system');
}
I am building a cordova app for android and iOS that stores user information in a local database. However, I am unable to open a database connection on iOS.
The app works perfectly on android, but when I run it on iOS I get an error saying that window.sqlite is undefined. I have been searching the internet, but I can't find a related issue. I am not sure if my code has been setup incorrectly, or if I am missing some configuration for iOS. The SQLite plugin I am using "cordova-sqlite-evplus-legacy-free 0.9.1", and the cordova iOS version is "5.0.1".
db = window.sqlitePlugin.openDatabase({
name: 'test.db',
location: 'default',
//iosDatabaseLocation: 'Library'
},
function(db) {
if (clean_database) dumpDatabase();
else buildSchemaVersions();
},
function(error) {
db_error = error;
alert('Open database ERROR: ' + error.message);
})
First of all: I would strongly advise against using a plugin for which the last update has been made more than 2 years ago, especially if it is for something as important as the database of your app. It is very likely that it has not been properly tested on current version of iOS. Why not use the more active plugin cordova-sqlite-storage? I have been using this plugin for years now without any issues whatsoever (iOS and Android).
For the question itself:
Did you make sure to make the openDatabase call after the deviceready event?
Was the plugin correctly added to the iOS platform? Please try removing it and adding it again and look out for any errors when it is added to the iOS platform.
Hello: I'm trying to get started with the ADAL plug-in for Cordova. Having used the native libraries a few times, I thought this would be pretty straightforward but I ran into a bit of an issue.
First of all my environment is VS2017, and the plugin is ADAL for Cordova 0.10.1.
I've created what I believe is the most simplistic example of a connection, using my own client application specifics and the ones provided in their sample online (which is) included below. My authentication looks like:
function authenticate(authCompletedCallback, errorCallback) {
var authority = "https://login.microsoftonline.com/common",
redirectUri = "http://localhost:4400",
resourceUri = "https://graph.windows.net",
clientId = "a5d92493-ae5a-4a9f-bcbf-9f1d354067d3";
var authContext = new Microsoft.ADAL.AuthenticationContext(authority);
authContext.acquireTokenAsync(resourceUri, clientId, redirectUri).then(authCompletedCallback, errorCallback);
This is then called in onDeviceReady();
acquireTokenAsync is called but doesn't appear to return either success or failure and a quick Fiddler trace doesn't appear to show the call which makes me wonder if it is not a configuration issue with Cordova to begin with.
I have commented out the Content-Security-Policy metatag with similar results.
Thank you in advance for any guidance!
Edit
Okay, perhaps this is helpful. I noticed that on the Cordova Plugin Simulation tab (I am trying to run this in the simulator in Chrome). I am seeing a dialog box with error:
There is no handler for the following exec call:
ADALProxy.acquireTokenAsync(...
Also, seems to work on a connected Android Device, just not in the local Simulator
The plug-in for Cordova doesn't support to run on the browser platform. When we developer an Cordova app and want to test on the browser platform, we have to ensure that the app depends on support the browser platform.
For the ADAL plug-in for Cordova support the platform:
Android (OS 4.0.3 and higher)
iOS Windows (Windows 8.0, Windows 8.1,
Windows 10 and Windows Phone 8.1)
And for other kinds of plug-in you can check it via you the Cordova plug-in.
I'm developing a mobile app both for iOS and Android, I didn't have any issues on android. But in iOS I encountered a problem when using plugins. Plugins I used were cordova-file-transfer and social sharing by EddyVerbruggen. Both plugins worked perfectly when I created my android app, but both got an issue when I did it in iOS. Both plugin only works after I restart the app. Why is that? I tried surrounding the code with $ionicPlatform.ready and device.ready but didn't help. What am I missing?
Here's a sample sequence code:
$scope.myButton = function(){
//I also tried surrounding this with
//document.addEventListener("deviceready", myfunction, false)
$ionicPlatform.ready(function(){
//mycode here that uses the plugin ex. ($cordovaFileTransfer.download)
});
}
I'm pulling my hair out on this one. I'm using phonegap 3.4 to build an iOS app. When I build the project and run in the simulator, I want to view the output of console.log in the xcode debug window, but it's not working. I've installed the org.apache.cordova.console plugin, but no luck. I see some normal debug output like "Resetting plugins due to page load" but none of my console.logs appear. Any ideas?
And this did not solve my issue: console.log is not working in iOS Phonegap App even after adding the console plugin
try alert();
it is basically the same as console.log();
but you need to install different plugins: org.apache.cordova.dialogs
i dont have iphone nor mac so i can't guarantee it will work on them. But in one android device that i tried, when the console.log() fails. Alert() succeeds.
There are 2 types of alert:
alert('text'); //this is actually javascript
navigator.notification.alert(message, alertCallback, [title], [buttonName]) //this is phonegap function
In my case. i have only need to use the first one.
further documentation on the second alert function is below:
https://cordova.apache.org/docs/en/3.0.0/cordova_notification_notification.md.html#notification.alert
i hope it will work on xcode too.
Make sure you install the console plugin. While Android is able to do this out of the box, logging to console is otherwise not supported on iOS:
https://github.com/apache/cordova-plugin-console/blob/master/doc/index.md
The solution is: call logger.__onDeviceReady function from your deviceready listener function:
function onDeviceReady() {
if (window.cordova.logger) {
window.cordova.logger.__onDeviceReady();
}
}
document.addEventListener('deviceready', onDeviceReady, false);
Try to use "document.write" instead.