1

In Android its working fine but in iOS its not working ?

I am using the katzer/cordova-plugin-local-notifications local notification in this its working well in androoid but its not working in iOS 8.

My Code is below

<script type="text/javascript" src="local-notification.js"></script>
        <script type="text/javascript">
            app.initialize();
        </script>
        <script>
        document.addEventListener('deviceready', function () {
        cordova.plugins.notification.local.registerPermission(function (granted) {
    //alert('Permission has been granted: ' + granted);
});

cordova.plugins.notification.local.schedule({
    text: "Wake up!",
    sound: "file://sounds/alert.caf",
    every: 30 // every 30 minutes
});

            var now             = new Date().getTime(),
            _5_sec_from_now = new Date(now + 5*1000);

            cordova.plugins.notification.local.schedule({
            text: "Delayed Notification",
            at: _5_sec_from_now,
            led: "FF0000",
            sound: null
            });
            var now                  = new Date().getTime(),
            _10_seconds_from_now = new Date(now + 10*1000);
            _20_seconds_from_now = new Date(now + 20*1000);
            window.plugin.notification.local.add({
            id:      1,
            title:   'Reminder 1',
            message: 'Only 10 Mins Left for parking expires',
            //repeat:  'weekly',
            sound:   "file://sounds/sound.mp3",
            date:    _10_seconds_from_now
            });
            window.plugin.notification.local.add({
            id:      2,
            title:   'Reminder 2',
            message: 'Parking time expires',
            //repeat:  'weekly',
            sound:     @#"file://sounds/sound.mp3",
            date:    _20_seconds_from_now
            });
            window.location="timer.html";
        }, false);

        </script>

config.html

<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>Park N Mark</name>
  <description></description>
  <author href="http://phonegap.com" email="support@phonegap.com">PhoneGap Team</author>
  <content src="index.html"/>
  <preference name="permissions" value="none"/>
   <preference name="phonegap-version" value="3.7.0" />
  <preference name="orientation" value="default"/>
  <preference name="target-device" value="universal"/>
  <preference name="fullscreen" value="false"/>
  <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="7"/>
  <preference name="android-installLocation" value="auto"/>
  <preference name="StatusBarOverlaysWebView" value="true" />
  <preference name="StatusBarBackgroundColor" value="#000000" />
  <gap:plugin name="com.phonegap.plugin.statusbar" />
 <gap:config-file platform="ios" parent="UIStatusBarHidden">
 <true/>
 </gap:config-file>
 <gap:config-file platform="ios" parent="UIViewControllerBasedStatusBarAppearance">
 <false/>
 </gap:config-file>
 <feature name="StatusBar">
            <param name="ios-package" value="CDVStatusBar" onload="true" />
        </feature>
  <gap:plugin name="org.apache.cordova.battery-status"/>
  <gap:plugin name="org.apache.cordova.camera"/>
  <gap:plugin name="org.apache.cordova.media-capture"/>
  <gap:plugin name="org.apache.cordova.console"/>
  <gap:plugin name="org.apache.cordova.contacts"/>
  <gap:plugin name="org.apache.cordova.device"/>
  <gap:plugin name="org.apache.cordova.device-motion"/>
  <gap:plugin name="org.apache.cordova.device-orientation"/>
  <gap:plugin name="org.apache.cordova.dialogs"/>
  <gap:plugin name="org.apache.cordova.file"/>
  <gap:plugin name="org.apache.cordova.file-transfer"/>
  <gap:plugin name="org.apache.cordova.geolocation"/>
  <gap:plugin name="org.apache.cordova.globalization"/>
  <gap:plugin name="org.apache.cordova.inappbrowser"/>
  <gap:plugin name="org.apache.cordova.media"/>
  <gap:plugin name="org.apache.cordova.network-information"/>
  <gap:plugin name="org.apache.cordova.splashscreen"/>
  <gap:plugin name="org.apache.cordova.vibration"/>
  <gap:plugin name="de.appplant.cordova.plugin.local-notification" />
  <gap:plugin name="com.phonegap.plugins.facebookconnect" version="0.8.0">
        <param name="APP_ID" value="205277553162176"/>
        <param name="APP_NAME" value="Demo_App01" />
  </gap:plugin>
  <icon src="icon.png"/>
  <icon src="www/res/icon/android/icon-36-ldpi.png" gap:platform="android" gap:qualifier="ldpi"/>
  <icon src="www/res/icon/android/icon-48-mdpi.png" gap:platform="android" gap:qualifier="mdpi"/>
  <icon src="www/res/icon/android/icon-72-hdpi.png" gap:platform="android" gap:qualifier="hdpi"/>
  <icon src="www/res/icon/android/icon-96-xhdpi.png" gap:platform="android" gap:qualifier="xhdpi"/>
  <icon src="www/res/icon/blackberry/icon-80.png" gap:platform="blackberry"/>
  <icon src="www/res/icon/blackberry/icon-80.png" gap:platform="blackberry" gap:state="hover"/>
  <icon src="www/res/icon/ios/icon-57.png" gap:platform="ios" width="57" height="57"/>
  <icon src="www/res/icon/ios/icon-72.png" gap:platform="ios" width="72" height="72"/>
  <icon src="www/res/icon/ios/icon-57-2x.png" gap:platform="ios" width="114" height="114"/>
  <icon src="www/res/icon/ios/icon-72-2x.png" gap:platform="ios" width="144" height="144"/>
  <icon src="www/res/icon/webos/icon-64.png" gap:platform="webos"/>
  <icon src="www/res/icon/windows-phone/icon-48.png" gap:platform="winphone"/>
  <icon src="www/res/icon/windows-phone/icon-173-tile.png" gap:platform="winphone" gap:role="background"/>
  <access origin="*"/>
</widget>

i am trying to solve this problem for last three days . Please help me out of this.

  • I believe it will be working and you are looking it as i did it when i tested on iphone. For iOS notifications, open the app and move it to background. Else if the app is in foreground, check for the notification in the notification drawer's Notifications tab. Try out this simple code for testing - $(document).ready(function() { document.addEventListener("deviceready", onDeviceReady, false); }); function onDeviceReady() { try { cordova.plugins.notification.local.schedule({ text: "This is the text.", at: new Date(new Date().getTime() + 10000) }); } catch (e) { alert("Fail " + e); } } – Gandhi Jun 24 '16 at 09:43

0 Answers0