can't initialize speechRecognition on cordova - kendo-ui

I have an app written in Keno UI (Telerik). I'm using build.phonegap.com to build runtime for my app, using cordova and Kendo. I'm stuck on getting the speechrecognition plugin to initialize. I'm sure it's something stupid but I'm not sure what it is.
Below is a copy of my config.xml file:
<?xml version='1.0' encoding='utf-8'?>
<widget id="ca.xyz.mmb" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>mmb</name>
<description>
Integrated Mobile Billing for XYZ Customers
</description>
<author email="support#xyz.ca" href="http://xyz.ca">
Go Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-compat" spec="^1.2.0" />
<plugin name="cordova-plugin-file" spec="^4.3.3" />
<plugin name="cordova-plugin-speechrecognition" spec="1.2.0" />
<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>
<engine name="ios" spec="^4.3.1" />
</widget>
Below is a copy of the relevant portion of the build:
Build Date: 2018-10-16 05:38:36 +0000
--------------------------------------------------------------------------------
PLUGIN OUTPUT
--------------------------------------------------------------------------------
Fetching plugin "cordova-plugin-compat#^1.2.0" via npm
Installing "cordova-plugin-compat" at "1.2.0" for android
Fetching plugin "cordova-plugin-file#^4.3.3" via npm
Installing "cordova-plugin-file" at "4.3.3" for android
Plugin dependency "cordova-plugin-compat#1.2.0" already fetched, using that version.
Dependent plugin "cordova-plugin-compat" already installed on android.
The Android Persistent storage location now defaults to "Internal".
Please check this plugin's README to see if your application needs any changes in its config.xml.
If this is a new application no changes are required.
If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:
"<preference name="AndroidPersistentFileLocation" value="Compatibility" />"
to config.xml in order for the application to find previously stored files.
Fetching plugin "cordova-plugin-speechrecognition#1.2.0" via npm
Installing "cordova-plugin-speechrecognition" at "1.1.2" for android
--------------------------------------------------------------------------------
PROJECT PROPERTIES
Below is the initalization code for the program.
(function () {
var bootstrap = function () {
$(function () {
alert("running bootstrap");
app.mobileApp = new kendo.mobile.Application(document.body, {
transition: 'slide',
skin: 'flat',
initial: 'components/home/view.html',
statusBarStyle: 'black-translucent',
layout: 'main'
});
alert("speech init "); //this is the last alert that pops up
window.plugins.speechRecognition.isRecognitionAvailable(
function(result) {
useSpeech = result ; alert("speech");
},
function(err) {
useSpeech = false; alert(err);
}
);
alert("done speech init");
});
};
bootstrap();
The place where I try to run isRecognitionAvailable is where it fails. I'm not sure why. I've tried putting in an alert for window.plugins just to see what it says but that always comes back undefined. A search on google implies that that is normal, so that doesn't help me much.

Related

Change base path on VS publish

I have a blazorWASM project. While developing, I need index.html to have it's base path set to <base href="/" />, but when I use the built-in publish to file, the output is set to land directly into my PHP project which acts as a host that serves WASM static files, and needs this base path: <base href="/wwwroot/" />.
Is there a way to have them automatically switched so I do not keep forgetting to do so? Alternatively, how do I configure the project so that it will work while I debug it on IIS with the wwwroot base path?
You need to add a build task to your CSPROJ Blazor WASM.
Important note: you need Newtonsoft 13.0.1, System.Text.Json isn't supported.
<UsingTask TaskName="ReplaceBaseHRef" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<InputFilename ParameterType="System.String" Required="true" />
<AppSettingsfile ParameterType="System.String" Required="true" />
<BaseHRefAttribute ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="$(NugetPackageRoot)\newtonsoft.json\13.0.1\lib\netstandard2.0\Newtonsoft.Json.dll" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Text" />
<Using Namespace="System.Text.RegularExpressions" />
<Using Namespace="Newtonsoft.Json" />
<Using Namespace="Newtonsoft.Json.Linq" />
<Code Type="Fragment" Language="C#">
<![CDATA[
var inputFile = File.ReadAllText(InputFilename);
var appsetting = File.ReadAllText(AppSettingsfile);
JObject appsettings = JObject.Parse(appsetting);
var baseHRef = appsettings[BaseHRefAttribute].Value<string>();
if (!string.IsNullOrEmpty(baseHRef)) {
Log.LogMessage( MessageImportance.High, baseHRef );
var outputFile = InputFilename;
var matchExpression = "\\<base\\ href=\\\"(.*)\\\"\\ \\/\\>";
var newBaseHRef = $"<base href=\"{baseHRef}\" />";
File.WriteAllText(
outputFile,
Regex.Replace(inputFile, matchExpression, newBaseHRef)
);
}
]]>
</Code>
</Task>
</UsingTask>
<Target Name="ReplaceBaseHRef" AfterTargets="Publish">
<ReplaceBaseHRef InputFilename="$(PublishDir)wwwroot\index.html" AppSettingsfile="$(PublishDir)wwwroot\appsettings.Production.json" BaseHRefAttribute="BaseHRef" />
</Target>
Now take your appsettings.Production.json and add the configuration setting as:
{
"BaseHRef": "/client/",
...
}
now launch the Publish (in folder, IIS or on Azure).
Your index.html will contain <base href="/client/" />.

how to run ionic app that works with api from another laravel app in real device?

the idea that i have laravel app and i want to make a mobile app that work with api from my laravel app . i succed to do this it's works perfectly in browser but when i want to test it with a real device or an emulator isn't work even i use the address ip of my computer to get the api from laravel app
instead of localhost
Sorry for my english and any one have idea for this problem please ?
this my code in ionic provider where i get the api
public token:any;
constructor(public storage:Storage ,public http: Http) {
console.log('Hello AuthProvider Provider');
}
login(credentials){
return new Promise((resolve, reject) => {
let headers = new Headers();
headers.append('Access-Control-Allow-Origin' , '*');
headers.append('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT');
headers.append('Accept','application/json');
headers.append('Content-type','application/json');
headers.append('X-Requested-With','XMLHttpRequest');
this.http.post('http://192.168.1.11:8101/api/auth/login', JSON.stringify(credentials), {headers: headers})
.subscribe(res => {
let data = res.json();
this.token = data.token;
localStorage.setItem('token',data.access_token);
resolve(data);
}, (err) => {
reject(err);
}); });
The code you have shared is not laravel code, this is your ionic code.
As you are saying your code is working in web app and not working in mobile platform with the same code. Then perhaps you are missing something from
config.xml file.
Please update this in your config.xml as it works fine for me.
<author email="alex#artisanfertility.com" href="https://artisanfertility.com">Alex Steinleitner</autho
<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-navigation href="*" />
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>

Why SAPUI5 loads similar fragment several times?

I have an XML fragment and use it in several places in an XML view.
<IconTabFilter text="ABC" key="1" icon="sap-icon://alphabetical-order">
<content>
<Table id="table1" width="auto" items="{path:'/ContactSet',parameters:{expand:'BusinessAddress,HomeAddress,OtherAddress,Photo'},filters:[{path:'Surname',operator:'StartsWith',value1:'A'},{path:'Surname',operator:'StartsWith',value1:'B'},{path:'Surname',operator:'StartsWith',value1:'C'}]}" noDataText=" {worklistView>/tableNoDataText}" busyIndicatorDelay="{worklistView>/tableBusyDelay}" growing="true" growingScrollToLoad="true" updateFinished="onUpdateFinished">
<headerToolbar>
<core:Fragment fragmentName="de.cimt.cimply.AddressBook.view.worklist.tablesHeader" type="XML"/>
</headerToolbar>
<columns>
<core:Fragment fragmentName="de.cimt.cimply.AddressBook.view.worklist.tablesColumns" type="XML"/>
</columns>
<items>
<core:Fragment fragmentName="de.cimt.cimply.AddressBook.view.worklist.tablesRows" type="XML"/>
</items>
</Table>
</content>
</IconTabFilter>
<IconTabSeparator icon="sap-icon://process"/>
<IconTabFilter text="DEF" key="2" icon="sap-icon://alphabetical-order">
<content>
<Table id="table2" width="auto" items="{path:'/ContactSet',parameters:{expand:'BusinessAddress,HomeAddress,OtherAddress,Photo'},filters:[{path:'Surname',operator:'StartsWith',value1:'D'},{path:'Surname',operator:'StartsWith',value1:'E'},{path:'Surname',operator:'StartsWith',value1:'F'}]}" noDataText="{worklistView>/tableNoDataText}" busyIndicatorDelay="{worklistView>/tableBusyDelay}" growing="true" growingScrollToLoad="true" updateFinished="onUpdateFinished">
<headerToolbar>
<core:Fragment fragmentName="de.cimt.cimply.AddressBook.view.worklist.tablesHeader" type="XML"/>
</headerToolbar>
<columns>
<core:Fragment fragmentName="de.cimt.cimply.AddressBook.view.worklist.tablesColumns" type="XML"/>
</columns>
<items>
<core:Fragment fragmentName="de.cimt.cimply.AddressBook.view.worklist.tablesRows" type="XML"/>
</items>
</Table>
</content>
</IconTabFilter>
But the view takes too long to load, especially in WEBIDE.
The reason is it loads similar fragment files several times. Here is an evidence:
The question is how can I improve the performance?
I don't want to repeat the code and I need to put that part of the code in a fragment, but I expected my browser to not load the same file several times.
There is no need to change your code in that case. SAP Web IDE / SCP leverages App Cache Buster concept out of the box, which fetches application resources (e.g. fragments) from the browser cache as long as those resources were not altered before.
See the sample screenshot below:
Given
Code:
<core:Fragment fragmentName="demo.view.fragment.MyFragment" type="XML" />
<core:Fragment fragmentName="demo.view.fragment.MyFragment" type="XML" />
<core:Fragment fragmentName="demo.view.fragment.MyFragment" type="XML" />
<core:Fragment fragmentName="demo.view.fragment.MyFragment" type="XML" />
<core:Fragment fragmentName="demo.view.fragment.MyFragment" type="XML" />
<core:Fragment fragmentName="demo.view.fragment.MyFragment" type="XML" />
URL attribute sap-ui-appCacheBuster=... which Web IDE automatically appends on app launch (describes where sap-ui-cachebuster-info.json is located)
If the devtool is open: Disable cache Unchecked <-- probably that was still activated in your case
Result
As you can see, fragments (and other resources) are loaded fron the disk cache instead of re-fetching them again and again.
Additionally, if the application is bundled for the final production environment, those fragments won't be even requested multiple times as they're typically already included in the bundled file (e.g. Component-preload.js).
If you run your app not in the webide testing environment the fragements should be loaded from cache.
However, you could load your fragment in your controller and use factoryfunctions instead of templates. Something like:
View:
<mvc:View controllerName="test.test.controller.View1" xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core" displayBlock="true" xmlns="sap.m">
<Shell id="shell">
<App id="app">
<pages>
<Page id="page" title="{i18n>title}">
<content>
<List items="{ path: '/myList', factory: '.myListFactory' }"/>
</content>
</Page>
</pages>
</App>
</Shell>
in your controller:
onInit: function () {
this.getView().setModel(new JSONModel({
"myList" : [{
"Name": "Test1"
}, {
"Name": "Test2"
}]
}));
},
myListFactory: function (sId) {
if(!this._myListFragment){
this._myListFragment = new sap.ui.xmlfragment("test.test.view.myListFragment", this);
}
return this._myListFragment.clone(sId);
}
fragment:
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">
<StandardListItem icon="sap-icon://warning" title="{Name}" />

How do I request permissions for my PhoneGap project built using PhoneGap Build?

I am trying to get started with Phonegap and Phonegap Build to create a html/jquery based Android app. Currently my app consists of one single html page that allows you to enter two numbers, those numbers are sent out to my server, and the response is displayed on screen. Here is the code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>PoC</title>
<script src="JS/jquery.min.js"></script>
<script src="JS/jquery-ui.min.js"></script>
<script language="javascript" src="JS/date.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="css/style.css">
<script>
function doCalc() {
$.ajax({
url: "http://nightscapecreations.com/test.cfc?method=multNums&thisNum=" + $('#thisNum').val() + "&multBy=" + $('#multBy').val()
}).done(function( data ) {
data = data.trim();
if ($.isNumeric(data)) {
$('#resultDiv').html(data);
} else {
$('#resultDiv').html(data);
}
})
}
</script>
</head>
<body>
<script type="text/javascript" src="cordova.js"></script>
This is a test. Here, multiply some numbers:
<input id="thisNum" placeholder="5" onChange="doCalc();"> x
<input id="multBy" placeholder="3" onChange="doCalc();">
=
<div id="resultDiv">
</div>
<input type="button" value="Calculate" onClick="doCalc();" style="width:150px;">
</body>
</html>
Just a very messy test to see how this whole thing works. This functions when opened on a browser, or when run through the Phonegap app. However, when I upload this to Phonegap Build, download the apk, copy it to the device, and install it there, the div fails to populate.
I looked at my app and was surprised to see it listed with no permissions. I suspect this is the cause of the failure; the app cannot access the internet and so cannot get a response back from its ajax call. This would also explain why PB's Weinre debugging shows no targets. However, no matter what I do I cannot figure out how to get PB to assign permissions.
This is my current config:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.nightscapecreations.test"
version="1.0.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:gap="http://phonegap.com/ns/1.0">
<name>Test</name>
<description>
A PoC app
</description>
<author email="xxxxxxxxxxxx#hotmail.com" href="http://phonegap.com">
My Name
</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>
<preference name="orientation" value="portrait"/>
<preference name="fullscreen" value="false"/>
<preference name="permissions" value="none"/>
<feature name="http://api.phonegap.com/1.0/network"/>
<plugin name="cordova-plugin-network-information" source="npm" spec="~1.2.0" />
</widget>
There's a lot in there because I've been going through countless iterations of trial and error with stuff pulled from all over SO and various blogs. I have tried with and without the preference tags, the feature tag, the plugin tag, and much more, but no permissions are ever requested by the app.
I also tried adding a security policy as suggested in another post, but without success:
<meta http-equiv="Content-Security-Policy"
content="default-src *;
style-src 'self' 'unsafe-inline' 'unsafe-eval';
script-src 'self' 'unsafe-inline' 'unsafe-eval';">
How do I insure that my app has sufficient privileges to get data from my server?

iOS pushnotification receiving Device Token but not no notification using Phonegap Build

I am trying to implement push notification using PhoneGap Build.
I am receiving a Device Token on my iOS Device but not receiving a Notification in the tray. Here my success call back is getting called but then the callback function is not getting called.
I have included the latest version of push plugin in config.xml.
Few Points about App:
This is my first app
I am implementing it using Phonegap Build
iOS device : Iphone 6s : iOS 9
Android Device: Samsung: Android 4.1.2
I am receiving the tray notification using below code in Android (though Android is delayed) but not in my iOS device.
Do Let me know if you need more information.
Here is the javascript code snippet.
onDeviceReady: function() {
//alert('Inside onDeviceReady');
var pushNotification = window.plugins.pushNotification;
//var device = window.plugins.
//alert ('Value of Variable Pushnotification : ' + pushNotification);
//alert ('Device Platform : ' + device.platform);
if (device.platform === 'android' || device.platform === 'Android')
{
//alert('Inside Register Call for Android');
pushNotification.register(app.successHandler, app.errorHandler,{"senderID":"935585158292","ecb":"app.onNotificationGCM"});
}
else
{
//alert('Inside Register Call for iOS');
pushNotification.register(app.pg_token_handler, app.pg_error_handler, {"badge": "true","sound":"true","alert":"true","ecb":"app.on_pg_apn_notification"});
}
},
on_pg_apn_notification: function(event)
{
if ( event.alert )
{
alert('Inside Alert call of APN Notification');
navigator.notification.alert(event.alert);
}
if ( event.sound )
{
alert('Inside sound call of APN Notification');
var snd = new Media(event.sound);
snd.play();
}
if ( event.badge )
{
alert('Inside Badge call of APN Notification');
pushNotification.setApplicationIconBadgeNumber(app.successHandler, app.errorHandler, event.badge);
}
}
}
Pasting Config.xml relevant code.
<?xml version="1.0" encoding="UTF-8"?>
<!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.phonegap.helloworld"
version = "1.0.0">
<name>CalendarSync</name>
<description>
This is my first application using PhoneGap
</description>
<author href="http://phonegap.com" email="support#phonegap.com">
Aditya Lele
</author>
<platform name="ios|winphone|wp8|android" />
<!--
If you do not want any permissions to be added to your app, add the
following tag to your config.xml; you will still have the INTERNET
permission on your app, which PhoneGap requires.
-->
<preference name="permissions" value="none"/>
<!-- Customize your app and platform with the preference element. -->
<preference name="orientation" value="default" /> <!-- all: default means both landscape and portrait are enabled -->
<preference name="target-device" value="universal" /> <!-- all: possible values handset, tablet, or universal -->
<preference name="fullscreen" value="true" /> <!-- all: hides the status bar at the top of the screen -->
<preference name="webviewbounce" value="true" /> <!-- ios: control whether the screen 'bounces' when scrolled beyond the top -->
<preference name="prerendered-icon" value="true" /> <!-- ios: if icon is prerendered, iOS will not apply it's gloss to the app's icon on the user's home screen -->
<preference name="stay-in-webview" value="false" /> <!-- ios: external links should open in the default browser, 'true' would use the webview the app lives in -->
<preference name="ios-statusbarstyle" value="black-opaque" /> <!-- ios: black-translucent will appear black because the PhoneGap webview doesn't go beneath the status bar -->
<preference name="detect-data-types" value="true" /> <!-- ios: controls whether data types (such as phone no. and dates) are automatically turned into links by the system -->
<preference name="exit-on-suspend" value="false" /> <!-- ios: if set to true, app will terminate when home button is pressed -->
<preference name="show-splash-screen-spinner" value="true" /> <!-- ios: if set to false, the spinner won't appear on the splash screen during app loading -->
<preference name="auto-hide-splash-screen" value="true" /> <!-- ios: if set to false, the splash screen must be hidden using a JavaScript API -->
<preference name="disable-cursor" value="false" /> <!-- blackberry: prevents a mouse-icon/cursor from being displayed on the app -->
<preference name="android-installLocation" value="auto" /> <!-- android: app install location. 'auto' will choose. 'internalOnly' is device memory. 'preferExternal' is SDCard. -->
<preference name="android-build-tool" value="gradle" />
<!--
Define a specific version of PhoneGap to build into your app.
-->
<preference name="phonegap-version"/>
<!-- Plugins -->
<!-- Core plugins -->
<gap:plugin name="com.phonegap.plugins.pushplugin" version="2.5.0"/>
<gap:plugin name="org.apache.cordova.device" spec="0.3.0" source="pgb" />
<!-- Third party plugins -->
<!-- A list of available plugins are available at https://build.phonegap.com/plugins -->
<!--
<gap:plugin name="com.phonegap.plugins.barcodescanner" />
-->
<!-- Define app icon for each platform. -->
<icon src="icon.png" />
<icon src="res/icon/android/icon-36-ldpi.png" gap:platform="android" gap:qualifier="ldpi" />
<icon src="res/icon/android/icon-48-mdpi.png" gap:platform="android" gap:qualifier="mdpi" />
<icon src="res/icon/android/icon-72-hdpi.png" gap:platform="android" gap:qualifier="hdpi" />
<icon src="res/icon/android/icon-96-xhdpi.png" gap:platform="android" gap:qualifier="xhdpi" />
<icon src="res/icon/blackberry/icon-80.png" gap:platform="blackberry" />
<icon src="res/icon/blackberry/icon-80.png" gap:platform="blackberry" gap:state="hover"/>
<icon src="res/icon/ios/icon-57.png" gap:platform="ios" width="57" height="57" />
<icon src="res/icon/ios/icon-72.png" gap:platform="ios" width="72" height="72" />
<icon src="res/icon/ios/icon-57-2x.png" gap:platform="ios" width="114" height="114" />
<icon src="res/icon/ios/icon-72-2x.png" gap:platform="ios" width="144" height="144" />
<icon src="res/icon/webos/icon-64.png" gap:platform="webos" />
<icon src="res/icon/windows-phone/icon-48.png" gap:platform="winphone" />
<icon src="res/icon/windows-phone/icon-173.png" gap:platform="winphone" gap:role="background" />
<!-- Define app splash screen for each platform. -->
<gap:splash src="res/screen/android/screen-ldpi-portrait.png" gap:platform="android" gap:qualifier="port-ldpi" />
<gap:splash src="res/screen/android/screen-mdpi-portrait.png" gap:platform="android" gap:qualifier="port-mdpi" />
<gap:splash src="res/screen/android/screen-hdpi-portrait.png" gap:platform="android" gap:qualifier="port-hdpi" />
<gap:splash src="res/screen/android/screen-xhdpi-portrait.png" gap:platform="android" gap:qualifier="port-xhdpi" />
<gap:splash src="res/screen/blackberry/screen-225.png" gap:platform="blackberry" />
<gap:splash src="res/screen/ios/screen-iphone-portrait.png" gap:platform="ios" width="320" height="480" />
<gap:splash src="res/screen/ios/screen-iphone-portrait-2x.png" gap:platform="ios" width="640" height="960" />
<gap:splash src="res/screen/ios/screen-iphone-portrait-568h-2x.png" gap:platform="ios" width="640" height="1136" />
<gap:splash src="res/screen/ios/screen-ipad-portrait.png" gap:platform="ios" width="768" height="1024" />
<gap:splash src="res/screen/ios/screen-ipad-landscape.png" gap:platform="ios" width="1024" height="768" />
<gap:splash src="res/screen/windows-phone/screen-portrait.jpg" gap:platform="winphone" />
<gap:config-file platform="ios" parent="CFBundleShortVersionString">
<string>100</string>
</gap:config-file>
<!--
Define access to external domains.
<access /> - a blank access tag denies access to all external resources.
<access origin="*" /> - a wildcard access tag allows access to all external resource.
Otherwise, you can specify specific domains:
<access origin="http://phonegap.com" /> - allow any secure requests to http://phonegap.com/
<access origin="http://phonegap.com" subdomains="true" /> - same as above, but including subdomains, such as http://build.phonegap.com/
<access origin="http://phonegap.com" browserOnly="true" /> - only allows http://phonegap.com to be opened by the child browser.
-->
<access origin="*"/>
<!-- Added the following intents to support the removal of whitelist code from base cordova to a plugin -->
<!-- Whitelist configuration. Refer to https://cordova.apache.org/docs/en/edge/guide_appdev_whitelist_index.md.html -->
<plugin name="cordova-plugin-whitelist" version="1" />
<!-- <plugin name="Device" value="org.apache.cordova.Device" spec="1.0.0" source="npm" />
<feature name="Device">
<param name="android-package" value="org.apache.cordova.device.Device" />
</feature>
<feature name="Device">
<param name="ios-package" value="CDVDevice" />
</feature> -->
<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>
IOS does not show a notification if the app is open, so I'm betting your code is correct.
From Apple Developer documents:
If your app is already in the foreground, iOS does not show the notification.
Source: Handling an Actionable Notification
I would recommend you write some custom notification like a popup to trigger when the app is open and a notification is received.

Resources