PhoneGap Build with OneSignal not working - phonegap-build

I'm using PhoneGap Build with OneSignal but it is not working. It shows only the first alert message.
Here is the code:
https://github.com/claudiosw/ZumitApp/
And you can download the app here:
https://build.phonegap.com/apps/2193000/builds
Also pasting the code here:
File config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.zumitapp" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>ZumitApp</name>
<description>Tenha Mais Resultados</description>
<author email="claudiosw#" href="http://zumitapp.com/App">Claudio Shigueo Watanabe</author>
<preference name="phonegap-version" value="cli-6.3.0" />
<feature name="http://api.phonegap.com/1.0/device" />
<preference name="orientation" value="portrait" /> <!-- all: default means both landscape and portrait are enabled -->
<gap:plugin name="org.apache.cordova.device" />
<gap:plugin name="org.apache.cordova.camera" />
<gap:plugin name="org.apache.cordova.media-capture" />
<gap:plugin name="org.apache.cordova.file" />
<gap:plugin name="org.apache.cordova.file-transfer" />
<gap:plugin name="org.apache.cordova.splashscreen" />
<gap:plugin name="org.apache.cordova.contacts" />
<gap:plugin name="org.apache.cordova.geolocation" />
<gap:plugin name="org.apache.cordova.inappbrowser" />
<gap:plugin name="org.apache.cordova.dialogs" />
<gap:plugin name="org.apache.cordova.vibration" />
<gap:plugin name="org.apache.cordova.network-information" />
<!--gap:plugin name="com.simplec.plugins.localnotification" /-->
<!--plugin name="com.onesignal.plugins.onesignal" spec="1.5.0" source="pgb" /-->
<!--plugin name="com.onesignal.plugins.onesignal" spec="1.9.0" source="pgb" /-->
<gap:plugin name="onesignal-cordova-plugin-pgb-compat" source="npm" />
<gap:plugin name="cordova-plugin-googleplayservices" source="npm" />
<gap:plugin name="cordova-plugin-android-support-v4" source="npm" />
<!--gap:plugin name="onesignal-cordova-plugin" source="npm" /-->
<!-- Recommend the newest cli but requires cli-5.1.1+ and gradle for Android. -->
<!-- If the below settings are not compatible with your project set the "PGB ANT" version above. -->
<!--preference name="android-build-tool" value="gradle" /-->
<icon src="icon.png" />
<icon src="res/icons/ios/Icon.png" gap:platform="ios" width="57" height="57" />
<icon src="res/icons/ios/Icon#2x.png" gap:platform="ios" width="114" height="114" />
<icon src="res/icons/ios/Icon-72.png" gap:platform="ios" width="72" height="72" />
<icon src="res/icons/ios/Icon-72#2x.png" gap:platform="ios" width="144" height="144" />
<icon src="res/icons/android/drawable-ldpi/Icon.png" gap:platform="android" gap:density="ldpi" />
<icon src="res/icons/android/drawable-mdpi/Icon.png" gap:platform="android" gap:density="mdpi" />
<icon src="res/icons/android/drawable-hdpi/Icon.png" gap:platform="android" gap:density="hdpi" />
<icon src="res/icons/android/drawable-xdpi/Icon.png" gap:platform="android" gap:density="xhdpi" />
<gap:splash src="ZumitApp_grande.jpg" />
<gap:splash src="res/screen/android/drawable-ldpi/splash.png" gap:platform="android" gap:density="ldpi" />
<gap:splash src="res/screen/android/drawable-mdpi/splash.png" gap:platform="android" gap:density="mdpi" />
<gap:splash src="res/screen/android/drawable-hdpi/splash.png" gap:platform="android" gap:density="hdpi" />
<gap:splash src="res/screen/android/drawable-xdpi/splash.png" gap:platform="android" gap:density="xhdpi" />
<gap:splash src="res/screen/ios/Default.png" gap:platform="ios" width="320" height="480" />
<gap:splash src="res/screen/ios/Default#2x.png" gap:platform="ios" width="680" height="960" />
<gap:splash src="res/screen/ios/Deafult-568h-2x.png" gap:platform="ios" width="640" height="1136" />
<preference name="stay-in-webview" value="true" />
<content src="index.html" />
<access origin="*" subdomains="true" />
<allow-navigation href="*" />
</widget>
File index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ZumitApp</title>
<script src="phonegap.js"></script>
<script src="jquery.min.js"></script>
<script>
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Now safe to use the Codova API
// Enable to debug issues.
alert("teste0");
window.plugins.OneSignal.setLogLevel({logLevel: 4, visualLevel: 4});
alert("teste1");
var notificationOpenedCallback = function(jsonData) {
console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
};
alert("teste2");
window.plugins.OneSignal.init("22a70849-091e-4eca-8b5b-e7fc5821f95b",
{googleProjectNumber: "428050097085"},
notificationOpenedCallback);
alert("teste3");
// Show an alert box if a notification comes in when the user is in your app.
window.plugins.OneSignal.enableInAppAlertNotification(true);
//alert("teste4");
window.location="http://zumitapp.com/App";
//alert("teste5");
}
</script>
</head>
<body>
<header class="bar bar-nav">
<h1 class="title">Boas-vindas ao ZumitApp</h1>
</header>
<h2>Aguarde. Carregando...</h2>
</body>
</html>
I have tried to debug but it didn't worked out. Maybe it is because my smartphone is old (LG-P705) or the desktop (Windows Vista).
Thanks you very much!

Related

Android Cordova app icon not filling space

I am attempting to get my app icon to fill the entire space of the circle, but it is only filling about 50% of the space, as seen here:
I am seeing this issue on both Google Pixel 6 and on Chromebook. On Samsung Galaxy S9, however, the icon fills the entire space, so I am unclear what the issue might be. My config file includes the following (generated by cordova-res):
<platform name="android">
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
How can I get the app icon to fill the entire space of the circle across all devices?

how to delete all the line items from the file after the first one

I need to delete all the line items <LineItem> from the file which does not suffice with this requirements:
elements in Line Item : <LineItemNumber V="00000000000000000010" /> and <PurchaseOrderNumber V="0100230946|00010" /> have to be matched, another words in integer Line Item Number would be 10 and Purchase order number after pipe line | would be 10. we need to have only one those line Items which are matching this requirement. Sorry, i'm really bad at describing.
<Transmission>
<InterchangeUsageIndicator V="T" />
<Groups>
<Group>
<GroupSenderID V="CCC" />
<TotalNumberOfShipmentsInGroup V="000005" />
<Documents>
<Document>
<DocumentHeader>
<InvoiceChargeType V="T" />
<DocumentType V="ORDER" />
<DocumentProcessingCode C="00" />
<BOLNumber V="BOL2309460180582136" />
<AlternateQuantities>
<AlternateQuantity Quantity="12.0" UOM="PK" UOMType="SQ" Characteristic="" />
</AlternateQuantities>
<Buyer Name="" Q="ZP" ID="COUSPO001">
<AlternateIDs />
</Buyer>
<Seller Name="" Q="2" ID="CNTR">
<AlternateIDs />
</Seller>
<Parties>
<Party PartyType="SF">
<Name V="SHA" />
<LocationID Q="" ID="" />
<AlternateLocationIDs>
<LocationID Q="" ID="SHA" />
</AlternateLocationIDs>
<City V="Shanghai" />
<Country V="CN" />
<LocationPurpose V="" />
</Party>
<Party PartyType="ST">
<Name V="LEB" />
<LocationID Q="" ID="" />
<AlternateLocationIDs>
<LocationID Q="" ID="LEB" />
</AlternateLocationIDs>
<City V="Lebanon" />
<Country V="TN" />
<LocationPurpose V="" />
</Party>
<Party PartyType="VN">
<Name V="YANGZHOU BAOYI SHOES" />
<LocationID Q="" ID="4100000423" />
<AlternateLocationIDs />
<City V="JIANGSU" />
<Country V="CN" />
<LocationPurpose V="" />
</Party>
</Parties>
<DateReferences>
<DR Type="D" Q="ETA" Date="2019-12-19" />
<DR Type="D" Q="EST" Date="2019-11-28" />
</DateReferences>
<ReservedReferences>
<RR Type="R" Q="K6" V="86|SEAL230946" />
<RR Type="R" Q="V3" V="VYG230946|BKG230946" />
</ReservedReferences>
</DocumentHeader>
<Vessel VesselName="VSL230946" VesselNumber="" VesselCountryOfRegistration="" VesselRegistrationNumber="" />
<Equipments>
<Equipment Initial="CNTR" Number="230946" Length="0" Type="" TotalContainerVolume="52.06" />
</Equipments>
<LineItems>
<LineItem>
<LineItemNumber V="00000000000000000010" />
<LineItemType C="LI" />
<TransportationServiceCode Code="" />
<PurchaseOrderNumber V="0100230946|00010" />
<AdditionalReferenceNumber V="" />
<DescriptionMarksAndNumbers>
<CommodityCode Q="" C="M9160" />
<BuyerProductID V="" />
</DescriptionMarksAndNumbers>
<BilledRatedAsQuantity V="0.0" UOM="PA" />
<LadingQuantity V="0.0" UOM="PA" />
<LineItemTotalAmount V="0.0" />
<LineItemWeight V="0.00" />
<LineItemVolume V="0.00" />
</LineItem>
<LineItem>
<LineItemNumber V="00000000000000900001" /> //this one would not work,because it is 900001
<LineItemType C="LI" />
<LineItemSubType C="SCH" />
<TransportationServiceCode Code="" />
<PurchaseOrderNumber V="0100230946|00010" />
<AdditionalReferenceNumber V="" />
<DescriptionMarksAndNumbers>
<CommodityCode Q="" C="M9160" />
<BuyerProductID V="" />
</DescriptionMarksAndNumbers>
<BilledRatedAsQuantity V="24.0" UOM="PA" />
<LadingQuantity V="24.0" UOM="PA" />
<LineItemTotalAmount V="0.0" />
<UserDefinedReferences>
<UDR Type="U" Q="CR" V="22859470896|001|0001" Description="" />
<UDR Type="U" Q="S6" V="|3|20" Description="" />
<UDR Type="U" Q="19" V="M9160|USDS|0001" Description="" />
</UserDefinedReferences>
<LineItemWeight V="2959.54" />
<LineItemVolume V="104.12" />
</LineItem>
<LineItem>
<LineItemNumber V="00000000000000900002" />
<LineItemType C="LI" />
<LineItemSubType C="SCH" />
<TransportationServiceCode Code="" />
<PurchaseOrderNumber V="0100230946|00010" />
<AdditionalReferenceNumber V="" />
<DescriptionMarksAndNumbers>
<CommodityCode Q="" C="M9160" />
<BuyerProductID V="" />
</DescriptionMarksAndNumbers>
<BilledRatedAsQuantity V="24.0" UOM="PA" />
<LadingQuantity V="24.0" UOM="PA" />
<LineItemTotalAmount V="0.0" />
<UserDefinedReferences>
<UDR Type="U" Q="CR" V="22859470902|001|0002" Description="" />
<UDR Type="U" Q="S6" V="|3.5|20" Description="" />
<UDR Type="U" Q="19" V="M9160|USDS|0001" Description="" />
</UserDefinedReferences>
<LineItemWeight V="2959.54" />
<LineItemVolume V="104.12" />
</LineItem>
I tried to start on LINQ: this is where I got so far:
try {
var xDoc = XDocument.Parse(msg.Body);
var xDocument = xDoc.Root.XPathSelectElement("Groups/Group/Documents/Document");
var xLineItems = xDocument.XPathSelectElements("LineItems/LineItem");
var poNumbers = xLineItems.Select(e => (string)e.Element("PurchaseOrderNumber").Attribute("V")).Distinct();
foreach (var poNumber in poNumbers) {
}
msg.Body = xDoc.ToString();
I believe you would like to Delete all LineItem where LineItemNumber!=10 and PurchaseOrderNumber after the Pipe NOT equals 10. You could use Linq to filter the elements that match the purpose and use the Remove method to deletes the selected nodes.
var xDoc = XDocument.Parse(xml);
xDoc.Descendants("LineItem")
.Where(x=> Convert.ToInt32(x.Element("LineItemNumber").Attribute("V").Value)!=10
&& Convert.ToInt32(x.Element("PurchaseOrderNumber").Attribute("V").Value.Split('|')[1])!=10
).Remove();
var result = xDoc.ToString();

Phonegap images not showing

I'm having trouble getting my images to work in my phonegap build.
I've read that the absolute paths might not work so i've tried both absolute and relative paths, still no luck.
I'm including the images like this:
<Col key={1} xs={3}>
<Image src='/tire_selected.png' responsive />
</Col>
or relative
<Col key={1} xs={3}>
<Image src='tire_selected.png' responsive />
</Col>
equals
<img class="img-responsive" src="tire_deselected.png" data-reactid=".0.0.1.0.0.0.0.1.1.0.0.$4.0">
Col & Image is bootstrap helper components using bootstrap-react. And this all works fine in the web view, but not when built with phonegap. It should though, the source is already compiled and without errors in both cases.
Following is my config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.app.exampleapp" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>App</name>
<description>
App
</description>
<author email="support#example.com" href="http://www.example.com">
Author
</author>
<content src="index.html" />
<preference name="permissions" value="none" />
<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="auto-hide-splash-screen" value="true" />
<preference name="disable-cursor" value="false" />
<preference name="android-minSdkVersion" value="14" />
<preference name="android-installLocation" value="auto" />
<gap:plugin name="org.apache.cordova.geolocation" />
<icon src="icon.png" />
<access origin="*" />
<plugin name="cordova-plugin-whitelist" version="1" />
<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>
Git repository:
app.js
vendor.js
config.xml
favicon.ico
humans.txt
index.html
robots.txt
tire_deselected.png
tire_selected.png
Icon.png works fine though. I have no idea whats causing the other images to not work. Any help would be appreciated!
Edit
I've tried setting content-security-policy, if that was the issue that i weren't able to set img-src and display images via javascript.
<meta http-equiv="Content-Security-Policy" content="
default-src http://10.3.10.104/ 'self' * 'unsafe-inline';
style-src http://10.3.10.104/ 'self' * 'unsafe-inline';
img-src http://10.3.10.104/ 'self' * 'unsafe-inline';
script-src http://10.3.10.104/ 'self' * 'unsafe-inline';">
But still no luck
file:///tire_deselected.png net::ERR_FILE_NOT_FOUND
There file is there, because when inserting an img-element into index.html it's displayed.
I even tried accessing it by the path that's displayed in the source folder running developer tools.
file:///data/user/0/com.oas.exampleapp/files/downloads/app_dir/tire_deselected.png
Doesn't work either, i'm starting to think that phonegap is broken, atleast works very poorly in combination with react.
After compilation the build.phonegap.com put your source files into "www" directory.
You can access your local image file using the following path "/android_asset/www/"
<image src='/android_asset/www/tire_selected.png' responsive />
If your image is placed in a subdirectory inside the root direcctory then you can use the following:
<image src='/android_asset/www/sub-direcctory/tire_selected.png' responsive />
Note: replace the "sub-direcctory" with your own if there is any in which the local image file is contained.
I added an img tag to index.html and set the src attribute to "images/logo.png" and it loads without issue.
...
<body>
<div id="root"></div>
<img id="footer-logo" src="images/logo.png" style="background-color: black; width: 200px;" />
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script src="js/vendor.bundle.js"></script>
<script src="js/app.bundle.js?v=2"></script>
</body>
</html>
I have a react component with an img tag and the same src value "images/logo.png"
...
<div style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0px; padding-top: 0px; letter-spacing: 0px; font-size: 24px; font-weight: 400; color: rgb(48, 48, 48); height: 64px; line-height: 64px; flex: 1 1 0px; text-align: center;">
<img id="header-logo" src="images/logo.png" style="width: 105px; margin-top: 16px;">
</div>
...
The img in the react component doesn't load; 404. Yet this equates to true
document.getElementById('footer-logo').src === document.getElementById('header-logo').src
How is it that one of the images loads and the other doesn't? Does it have something to do with the react component being loaded into the DOM dynamically or react's virtual DOM?
The src attributes equate to file:///images/logo.png. IF I set the src attribute on the #header-logo like this, it loads:
document.getElementById('header-logo').src = cordova.file.applicationDirectory + "www/images/logo.png"
Hope this provides more info to this very bizarre behaviour.
Hope this helps. So I also had the problem.
What I did was, was to create a another folder /images/ (duplicate) and still use my images I imported via react via my /static/components/images folder. You can take it a bit further by adding conditionals for staging or live.
So the answer is here.:
import Logo from '../images/logo.png';
<img src={`./${Logo}`} alt="Logo" />
Full example.:
import React, { Component } from 'react';
import Logo from '../images/logo.png';
class Header extends Component {
render() {
return(
<div className="logo mt-3">
<img src={`./${Logo}`} alt="Logo" />
</div>
);
}
}
export default Header;
Got the idea from this post.: Images not showing in PhoneGap Build application

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.

Cordova Plugin add folder to root of project

Making a custom cordova plugin, I need to add the sdk files to the root level of the xcode project, but it always ends up in the plugins folder of the xcode project
how do I add the folders (XIBs and MiSnap_Res) to the root of the project so they are a gold colored folder, not blue, or at least on the project level, outside the plugins folder
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="com.keybank.MiSnapPlugin"
version="0.0.1">
<name>MiSnapPlugin</name>
<description>MiSnapPlugin Custom Plugin Made by Derek Hannah</description>
<author>Derek Hannah</author>
<license>Apache 2.0 License</license>
<engines>
<engine name="cordova" version=">=3.5.0" />
</engines>
<js-module src="www/MiSnapPlugin.js" name="MiSnapPlugin">
<clobbers target="MiSnapPlugin" />
</js-module>
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="MiSnapPlugin">
<param name="ios-package" value="MiSnapPlugin" />
</feature>
</config-file>
<framework src="libstdc++.6.tbd" />
<framework src="AudioToolbox.framework" />
<framework src="AVFoundation.framework" />
<framework src="CoreGraphics.framework" />
<framework src="CoreMedia.framework" />
<framework src="CoreVideo.framework" />
<framework src="MobileCoreServices.framework" />
<framework src="QuartzCore.framework" />
<framework src="OpenGLES.framework" />
<framework src="Security.framework" />
<framework src="ImageIO.framework" />
<framework src="Foundation.framework" />
<framework src="Foundation.framework" />
<framework src="UIKit.framework" />
<source-file src="src/ios/libMiSnap.a" framework="true" />
<resource-file src="src/ios/MiSnap_Res"/>
<source-file src="src/ios/XIBs" target-dir="../.."/>
<header-file src="src/ios/include/MiSnap.h" />
<header-file src="src/ios/MiSnapPlugin.h" />
<source-file src="src/ios/MiSnapPlugin.m" />
</platform>
<!--<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="HelloWorldPlugin">
<param name="android-package" value="mobi.monaca.HelloWorldPlugin"/>
</feature>
</config-file>
<source-file src="src/android/mobi/monaca/HelloWorldPlugin.java" target-dir="src/mobi/monaca" />
</platform>-->
</plugin>

Resources