I'm new to Blackberry. I use phonegap to create cross platform applications. My html file is very simple. It looks like this:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" id="viewport" content="height=device-height,width=device-width,user-scalable=no" />
<title>Insert title here</title>
<script type="text/javascript" charset="utf-8" src="www/phonegap-1.3.0.js"></script>
</head>
<body>
<p>Hello World</p>
</body>
</html>
I have added phonegap-1.3.0.js file that is available for blackberry phonegap.
My config.xml contains these permissions:
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0.0.0">
<name>Cps1</name>
<feature id="blackberry.app" required="true" version="1.0.0.0"/>
<feature id="blackberry.app.event" required="true" version="1.0.0.0"/>
<feature id="blackberry.system" required="true" version="1.0.0.0"/>
<feature id="com.phonegap" required="false" version="1.0.0"/>
<feature id="blackberry.system.event" required="true" version="1.0.0.0"/>
<feature id="blackberry.invoke" required="true" version="1.0.0.0"/>
<feature id="blackberry.invoke.BrowserArguments" required="true" version="1.0.0.0" />
<feature id="blackberry.identity" required="true" version="1.0.0.0"/>
<feature id="blackberry.utils" required="true" version="1.0.0.0"/>
<content src="index.html"/>
</widget>
On debugging it shows "Reference error: Com is not defined" in phonegap.js file. Can anyone please help me as what else has to be done?
Check the version number of phonegap u added and try with
and check the phone gap jar file is added to u r project or not??
Related
I'm trying to run a HelloWorld application in Angular + Cordova, but it does not work well when I run it with the ios emulator (iPhone 12 Pro Max - iOS 14.4). I'm getting a blank page (screenshot below).
I have already changed the href="/" in my index.html to href="./" but it doesn't work. I added ios platform with "cordova platform add ios" command line and I have installed all the requirements as: XCode, ios-deploy and CocoaPods tools.
I created the Angular project with Angular CLI and did not modify anything. After, I created the Cordova project inside and linked the dist folder to the www folder.
Versions:
Cordova version 10.0.0 - Angular version 11.2.9 - Angular CLI version 11.2.8 - Node version 15.14.0
Blank Page Screenshot
this is the config.xml file:
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev#cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
this is the index.html file in www folder:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HelloWorldAngularCordova</title>
<base href="./">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles.3ff695c00d717f2d2a11.css"></head>
<body>
<app-root></app-root>
<script src="runtime.7b63b9fd40098a2e8207.js" defer></script><script src="polyfills.00096ed7d93ed26ee6df.js" defer></script><script src="main.80cad638da592e13f2e3.js" defer></script></body>
</html>
Where is my error(s)? Thanks
You need to add
<script type=”text/javascript” src=”cordova.js”></script>
in your index.html file.
Then in main.ts:
let onDeviceReady = () => {
platformBrowserDynamic().bootstrapModule(AppModule);
};document.addEventListener('deviceready', onDeviceReady, false);
like here:
binding angular with cordova
config.xml
<xml version='1.0' encoding='utf-8'?>
<widget id="com.leo9.gameofplan" version="0.0.4" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Game Of Plan</name>
<description>The Game of Plan app is designed to: Capture your Thoughts and Feelings and convert it into Tangible Action Plan.</description>
<author email="info#leo9studio.com" href="https://leo9studio.com/">Le9studio Team</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="WKWebViewOnly" value="true" />
<preference name="CordovaWebViewEngine" value="CDVUIWebViewEngine" />
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="28" />
<preference name="BackupWebStorage" value="none" />
<preference name="DisallowOverscroll" value="true" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreenDelay" value="10000" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="30000" />
<preference name="OverrideUserAgent" value="Mozilla/5.0 Google" />
<allow-navigation href="*" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.0.0">
<variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
</plugin>
<plugin name="cordova-plugin-network-information" spec="~2.0.1" />
<plugin name="cordova-plugin-secure-storage" spec="^3.0.2" />
<plugin name="cordova-plugin-screen-orientation" spec="^3.0.2" />
</widget>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Game of Plan</title>
<base href="." />
<meta name="viewport"
content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="format-detection" content="telephone=no" />
<meta http-equiv="Content-Security-Policy"
content="font-src 'self' data:; img-src * data:; default-src gap://ready file://* *; script-src 'self' 'unsafe-inline' 'unsafe-eval' * ; style-src 'self' 'unsafe-inline' *">
<meta name="msapplication-tap-highlight" content="no" />
<link rel="icon" type="image/png" href="assets/icon/favicon.png" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
</head>
<body>
<app-root></app-root>
</body>
</html>
here i attache my config.xml and index.html file.
my app is stuck at splash screen in ios13+ devices. for that reasons the app is rejected for publish for app store. i tried many thing to resolve this error. degrade splash screen plugin that wont work, also added some splash screen related config line into config.xml that also wont work.
what should be the solution?
Yu should add the following code inside your <platform name="ios"> tag:
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
Taken from here: https://cordova.apache.org/howto/2020/03/18/wkwebviewonly.html
I have never used Cordova splashscreen but looking at your config.xml content I see that you have a duplicate SplashScreenDelay preference, one has a value of 30000, the equivalent of 30 seconds and the other has a value of 10000, this can be the reason behind the problem. I would remove the duplicate preference and set the time value to 5000 (5 seconds), I would also add AutoHideSplashScreen preference and set it to false, then add the a timer in the deviceready event handler:
function onDeviceReady() {
setTimeout(function () {
navigator.splashscreen.hide();
}, 5000);
}
It should be explained in here. Check this too.
I hope this helps.
I'm building mobile app using phonegap build. I have build app for iOS, Android and windows and I'm testing it in TestObject. What I'm doing in my app is redirecting to http://google.com on page load itself.
index.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" charset="utf-8">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, true);
}
function onDeviceReady() {
window.location.href = "http://google.com";
}
</script>
</head>
<body onload="onLoad();">
</body>
</html>
config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.newApp.mobileApp"
versionCode = "1"
version = "1.0.0" >
<!-- versionCode is Android only -->
<!-- version is in major.minor.patch format -->
<name>My New App</name>
<description>
An example for phonegap build app which wont show up in the playstore.
</description>
<author href="https://YourWebsite.com" email="yourEmail#goesHere.com">
Name Of The Author
</author>
<plugin name="cordova-plugin-whitelist" source="npm"/>
</widget>
While testing with android (apk file), it is redirecting to google.com. But when I test with iOS device (ipa file), it is showing blank page only.
Why it is not working for iOS?
Can anyone help me to fix this? Thanks in advance.
<access origin="*" launch-external="yes" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<access origin="http://127.0.0.1*"/>
<allow-navigation href="*"/>
<allow-intent href="*"/>
to be on safe side regarding whitelist , i use these intents in my app
in addition to above , i added this plugins for Android
<gap:plugin name="cordova-plugin-whitelist" version="1.1.0" source="npm" />
and for IOS
<plugin name="cordova-plugin-whitelist" spec="https://github.com/apache/cordova-plugin-whitelist.git" />
I am trying to implement a chat application using XMPPFramework in iOS, using OpenFire server. My chat is working fine, I am trying to retrieve chat history from server. Ofcourse I have enabled Message Archiving on Server. This is the Request I am sending
<iq type="get">
<retrieve xmlns="urn:xmpp:archive" with="dev_user80#mydomain">
<set xmlns="http://jabber.org/protocol/rsm">
<max>100</max>
</set>
</retrieve>
</iq>
This is the response I am getting.
<iq xmlns="jabber:client" type="error" to="dev_user103#mydomain/6i0qoo9tek">
<retrieve xmlns="urn:xmpp:archive" with="dev_user80#mydomain">
<set xmlns="http://jabber.org/protocol/rsm">
<max>100</max>
</set>
</retrieve>
<error code="503" type="cancel">
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
</service-unavailable>
</error>
</iq>
I have gone through all the solutions I could find on the internet but could not find a satisfying solution
change urn:xmpp:archive to urn:xmpp:archive:auto
I had the same issue and determined this by running a discovery request: http://xmpp.org/extensions/xep-0136.html#disco
I sent this IQ:
<iq from='user#mydomain.com'
id='disco1'
to='mydomain.com'
type='get'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
My Openfire server with the Monitoring plugin enabled returned this result:
<iq xmlns="jabber:client" type="result" id="disco1" from="mydomain.com" to="user#mydomain.com/resource">
<query xmlns="http://jabber.org/protocol/disco#info">
<identity category="server" name="Openfire Server" type="im" />
<identity category="pubsub" type="pep" />
<feature var="http://jabber.org/protocol/pubsub#retrieve-default" />
<feature var="http://jabber.org/protocol/pubsub#purge-nodes" />
<feature var="vcard-temp" />
<feature var="http://jabber.org/protocol/pubsub#subscribe" />
<feature var="http://jabber.org/protocol/pubsub#subscription-options" />
<feature var="http://jabber.org/protocol/pubsub#create-nodes" />
<feature var="http://jabber.org/protocol/pubsub#outcast-affiliation" />
<feature var="msgoffline" />
<feature var="http://jabber.org/protocol/pubsub#get-pending" />
<feature var="http://jabber.org/protocol/pubsub#multi-subscribe" />
<feature var="http://jabber.org/protocol/pubsub#presence-notifications" />
<feature var="urn:xmpp:ping" />
<feature var="jabber:iq:register" />
<feature var="http://jabber.org/protocol/pubsub#delete-nodes" />
<feature var="http://jabber.org/protocol/pubsub#config-node" />
<feature var="urn:xmpp:archive:manage" />
<feature var="http://jabber.org/protocol/pubsub#retrieve-items" />
<feature var="http://jabber.org/protocol/pubsub#auto-create" />
<feature var="http://jabber.org/protocol/disco#items" />
<feature var="http://jabber.org/protocol/pubsub#item-ids" />
<feature var="http://jabber.org/protocol/pubsub#meta-data" />
<feature var="urn:xmpp:mam:0" />
<feature var="jabber:iq:roster" />
<feature var="http://jabber.org/protocol/pubsub#instant-nodes" />
<feature var="http://jabber.org/protocol/pubsub#modify-affiliations" />
<feature var="http://jabber.org/protocol/pubsub#persistent-items" />
<feature var="http://jabber.org/protocol/pubsub#create-and-configure" />
<feature var="http://jabber.org/protocol/pubsub" />
<feature var="http://jabber.org/protocol/pubsub#publisher-affiliation" />
<feature var="http://jabber.org/protocol/pubsub#access-open" />
<feature var="http://jabber.org/protocol/pubsub#retrieve-affiliations" />
<feature var="jabber:iq:version" />
<feature var="http://jabber.org/protocol/pubsub#retract-items" />
<feature var="urn:xmpp:time" />
<feature var="http://jabber.org/protocol/pubsub#manage-subscriptions" />
<feature var="jabber:iq:privacy" />
<feature var="jabber:iq:last" />
<feature var="http://jabber.org/protocol/commands" />
<feature var="http://jabber.org/protocol/offline" />
<feature var="urn:xmpp:carbons:2" />
<feature var="http://jabber.org/protocol/address" />
<feature var="http://jabber.org/protocol/pubsub#publish" />
<feature var="http://jabber.org/protocol/pubsub#collections" />
<feature var="http://jabber.org/protocol/pubsub#retrieve-subscriptions" />
<feature var="urn:xmpp:archive:auto" />
<feature var="http://jabber.org/protocol/disco#info" />
<feature var="jabber:iq:private" />
<feature var="http://jabber.org/protocol/rsm" />
</query>
</iq>
You can see that Automatic Archiving (urn:xmpp:archive:auto) and Archive Management (urn:xmpp:archive:manage) are supported, but Manual Archiving (urn:xmpp:archive:manual) and Archiving Preferences (urn:xmpp:archive:pref) are not.
XEP-0313 is also supported (listed as urn:xmpp:mam:0) and can retrieve archived messages: http://xmpp.org/extensions/xep-0313.html
I hope someone can help me figure this out. This is my first Phonegap app, so this could be a fairly elementary mistake on my part. I'm specifically trying to get this to work on iOS. Android will wait until another day.
I'm trying to load a page from an external site (which I do control) using the inAppBrowser. After the user leaves the initial page, it should close and return them to the app. The page opens successfully, but I've tried everything I can think of to get it to close and return to the app, but to no avail.
The function using inAppBrowser looks like this:
function open_page() {
var ref = window.open('http://www.mydomain.com/page1.html', '_blank', 'location=yes,enableViewportScale=no');
ref.addEventListener('loadstop', function(event) { if(event.url != "http://www.mydomain.com/page1.html") ref.close(); });
ref.addEventListener('exit', function(event) { alert(event.type); });
}
I am using the cloud-based Phonegap Build, and my config.xml file looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<widget
...
<access origin="*" />
<preference name="phonegap-version" value="3.0.0" />
<preference name="orientation" value="portrait" />
<preference name="fullscreen" value="true" />
<preference name="stay-in-webview" value="true" />
<feature name="http://api.phonegap.com/1.0/battery"/>
<feature name="http://api.phonegap.com/1.0/camera"/>
<feature name="http://api.phonegap.com/1.0/contacts"/>
<feature name="http://api.phonegap.com/1.0/file"/>
<feature name="http://api.phonegap.com/1.0/geolocation"/>
<feature name="http://api.phonegap.com/1.0/media"/>
<feature name="http://api.phonegap.com/1.0/network"/>
<feature name="http://api.phonegap.com/1.0/notification"/>
<feature name="InAppBrowser">
<param name="ios-package" value="CDVInAppBrowser" />
</feature>
<gap:plugin name="org.apache.cordova.device" />
<gap:plugin name="org.apache.cordova.camera" />
<gap:plugin name="org.apache.cordova.device-orientation" />
<gap:plugin name="org.apache.cordova.file" />
<gap:plugin name="org.apache.cordova.globalization" />
<gap:plugin name="org.apache.cordova.inappbrowser" />
<gap:plugin name="org.apache.cordova.network-information" />
<gap:plugin name="org.apache.cordova.dialogs" />
<gap:plugin name="org.apache.cordova.splashscreen" />
<gap:plugin name="org.apache.cordova.core.geolocation" />
</widget>
Thanks in advance for all help!
Add this to your config file-
<access origin="*" browserOnly="true"/>
For open link in APP browser use following line, which open link in app browser.
And return back to your application when you closed it.
window.open('http://www.' + email, '_blank', 'location=yes');