Git Product home page Git Product logo

pushnotificationsample's Introduction

Push Notification Sample App

A sample mobile application built with Ionic and ngCordova to demonstrate how to register for and receive push notifications on iOS and Android. Once the device registration token is received, it is sent to a locally running node service where it will be stored for later use when a push notification needs to be broadcast to all subscribed devices using node-pushserver. The setup to use node-pushserver is discussed more below but see the npm site for specific setup details.

** See related blog post for more details!

Push Notification Sample on iOS

Push Notification Sample on Android Nexus 7

** PRE-REQUISITES

You must install the following plugins for this app to work properly:

  • PushPlugin

  • console

  • device

  • dialogs

  • media

  • file

  • ToastPlugin

      $ ionic plugin add org.apache.cordova.console
      $ ionic plugin add org.apache.cordova.device
      $ ionic plugin add org.apache.cordova.dialogs    
      $ ionic plugin add org.apache.cordova.file
      $ ionic plugin add org.apache.cordova.media
      $ ionic plugin add https://github.com/phonegap-build/PushPlugin
      $ ionic plugin add https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git
    

Sending Push Notifications to your App

A couple options are included for sending push notifications to this application. You can use node-pushserver to store multiple device tokens from different platforms and send in bulk, or if you just want to test sending one simple message, there are two simple node services included to do that as well (node-apn and node-gcm).

Send to Multiple Devices and Store Tokens (better approach)

####node-pushserver Check out node-pushserver to manage push notifications and device tokens with mongodb database. This sample includes a subscribe.js file sample node/express service which can be used to subscribe a user for push notifications from the app. You can then send push notifications from your the web browser easily and quickly using their UI as shown here.

The app is currently setup to point to my local instance of pushserver so you can just change it to your URL to use this approach.

When the app starts it will automatically try to register the user for push notifications. It will then retrieve the device token from the result and store it with the platform type (ios, android) (along with a random user name currently) thru a call to the node-pushserver API into a mongodb database. You will need to provide your mongodb database name and configuration details to use node-pushserver in the config.json file as shown in Step 3 here and supply the path to your version of the file when you start it up.

Then modify the URL in the project js/controllers.js file to match your own setup. If you're running your node-pushserver instance from localhost, you may have to provide the explicit URL from your local network settings such as below:

Change this line in PushNotificationSample/www/js/controllers.js to match your own network URL where you're running node-pushserver:

$http.post('http://192.168.1.5:8000/subscribe', JSON.stringify(user)

Sending to One Device Manually (quick testing)

The app is currently setup to receive push notifications from this approach as well. You just need to update the sendMsg.js or sendGCM.js files to use your device tokens and certificates as needed.

#####iOS (APNS) Simple Node Service to send push notifications I've also included a node service example called sendMsg.js for sending push notifications using the node-apn library to your iOS devices. Run this manually with your own configuration from node.

$ node sendMsg.js

#####Android (GCM) node-gcm Simple Node Service to send push notifications This sample also includes a node service example called sendGCM.js for sending push notifications using the node-gcm library to your Android devices.

$ node sendGCM.js

#####Extra subscribe.js is yet another node service that can be used to manually add a user and token into your locally running node-pushserver instance instance.

$ node subscribe.js

####Resources - HIGHLY RECOMMENDED REFERENCES

The answers to your questions about Apple Push Notifications and Google Cloud Messaging configuration can be found in my previous posts. If you're not familiar with the setup, you will save yourself headache at least reading thru the configuration portion for each. You will need certain resources from them and have to specifically enable your iOS for Push Notifications thru the Apple Developer site.

1-Very explanatory post with screenshots by Burke Holland to walk you through Apple Push Notification setup.

2-My tutorial on iOS/Apple Push Notifications

3-My tutorial on Android/GCM

4-My PushPlugin Basic Tutorial

###More about ngCordova ngCordova is an AngularJS wrapper library for working with Cordova plugins. It's essentially a set of AngularJS directives to help keep your plugin code clean, organized and more maintainable. I've included the library already in the /lib folder but you will need to be sure all of the required plugins are installed:

####Miscellaneous/Setup Notes####

1-Run mongo $ mongod

or 
 `$ sudo mongod`

2-Run pushserver

`$ pushserver -c config.json`

3-If running from localhost, ensure you're use the raw ip address of your network in the controllers.js (192.168.1.*) unless you have some other way to map your localhost name.

** You'll need to refresh your browser to get the new users/tokens to load if you don't default to all before sending a message.

4-If you think all is setup right but don't receive notifications on your Android device, ensure you're using an API credentials key in your service that is associated with the GCM project id you specific in controllers.js.

iOS Sample Message Payload

[{"badge":"0","sound":"soundName","alert":"Jennifer L liked your photo","foreground":"0"}]

Android Sample Message Payload [{"message":"Tori432 commented on your photo: Awesome!","payload":{"message":"Tori432 commented on your photo: Awesome!"},"collapse_key":"optional","from":"824841663931","foreground":true,"event":"message"}]"

###Unregistering - When a user deletes/uninstalls your app In the sample app you will see that the local unregister method is simply removing the device token from the database, not calling the unregister() method in the PushPlugin. Please read the following links to get the details about why this is recommended, followed by some more details regarding invalid token handling for each platform:

###Removing device tokens from your 3rd party server So how do you determine when to remove a device token from your own 3rd party server so you don't have unnecessary overhead? The two services handle it differently, below are some details and further links to check out:

GCM Handling

Google notes that 'When users uninstall an application, it is not automatically unregistered on GCM. It is only unregistered when the GCM server tries to send a message to the device and the device answers that the application is uninstalled or it does not have a broadcast receiver configured to receive com.google.android.c2dm.intent.RECEIVE intents. At that point, your server should mark the device as unregistered (the server will receive a NotRegistered error).'

See this link for advanced concepts and other useful information surrounding this.

Apple's Feedback Service APNs provides a useful Feedback Service that can be queried to find any device tokens that are no longer valid, for instance if the user deleted your app from their device. Apple recommends you query the service once per day to find any invalid tokens and remove them from your own database to reduce unnecessary message overhead and improve overall system performance.

The pushserver library also has an interface built into it for accessing this service that you can take advantage of. It is also configured via the config.json file. If a device token is found to be invalid, it should be reported in the terminal window where pushserver is running.

pushnotificationsample's People

Contributors

hollyschinsky avatar pbernasconi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pushnotificationsample's Issues

How do i get Badge Number in case I have multiple notifications

I am implementing this plugin in Android, how do I get number of unseen notification, actually I need to control the redirection after after notification click, I need to open some screen if number of notification is one and other screen if number of notifications are more than one.

Cannot run the sample

0 848017 error TypeError: Cannot read property 'pushNotification' of un
defined
at Object.register (http://192.168.1.133:8100/lib/ng-cordova.js:4484:36)
at Scope.$scope.register (http://192.168.1.133:8100/js/controllers.js:33:22)

at http://192.168.1.133:8100/js/controllers.js:12:16
at wrappedCallback (http://192.168.1.133:8100/lib/ionic/js/ionic.bundle.js:1

9197:81)
at http://192.168.1.133:8100/lib/ionic/js/ionic.bundle.js:19283:26
at Scope.$eval (http://192.168.1.133:8100/lib/ionic/js/ionic.bundle.js:20326
:28)

when notification clicked from status bar

Any way to make a list of recent notifications and when you click the status bar it goes to a page in the app to show them?

Also, how do you set the little circle icon for the push notification. It is currently using my app Icon which is square and looks weird.

Sending Push Notifications to my App

Hello,
First, let me thank you for this example & blogs. I have been trying to learn how to use this sample, and unfortunately I am not able to send notification with node-pushserver so please elaborate your steps.
Where to use mongodb & how it is config & what are the steps to install all this sequentialy as i am beginner.
Thank you once again.

IOS is lock

Hi dears,

Is working when IOS is lock?

Thanks,

/subscribe dont accept my post

hi,well i'm having some trouble when im saving the token of my device i follow your tutorial and when i use the "node subscribe.js" the token is saved in the node-push server but when i'm traying of doing it in the normal way in the console appears

Register success OK
5 410034 log [{"regid":"APA91bHRkzimNds5qwpsbsA2dPHDwDOKvVkRXq3lNXvVD9lTIAd9FJiU0H4s7Ea5qYw2cyPebXvkGLEGLG7LjHQonbjUwGzp0Hv37XK85GqQ_LDwZ6p-NfhTXHWj_9aeGsym9trV-N_BsR6CJXPyRYdxeKBCkabyFWeUvAZUo33zaRlij-l0YuU","event":"registered"}]
6 410038 log In foreground undefined Coldstart undefined
7 410041 log Post token for registered device with data {"user":"user6812638","type":"android","token":"APA91bHRkzimNds5qwpsbsA2dPHDwDOKvVkRXq3lNXvVD9lTIAd9FJiU0H4s7Ea5qYw2cyPebXvkGLEGLG7LjHQonbjUwGzp0Hv37XK85GqQ_LDwZ6p-NfhTXHWj_9aeGsym9trV-N_BsR6CJXPyRYdxeKBCkabyFWeUvAZUo33zaRlij-l0YuU"}
8 410500 log Error storing device token.null 0
so i cant be aviable of send notification in that way :/

Error when start

i have this error:
Cannot read property 'ecb' of null
at Object.register (ng-cordova.js:4480)

Someone knows why?

Push Notification not calling $rootScope.$on('$cordovaPush:notificationReceived')

Hi ,
I have spent 3 days to find solution for this , I dubug it on xcode and check onNotification that is inject , I manually tried to feed it to get call of notification handled but it is not working and Push notification is come only background case., Please let me know why it is happening Please Please...

Thanks
Shivam

Not storing RegID or any notifications for view in app

I think there may be an issue with the data being stored locally on the phone. I was wondering why 1) The "Device Token" on the app screen stays blank even though the phone registers, 2) The registration post for the user data to go to the server is not working. 3) The notifications are not being displayed on the app dashboard. 4) The Unregister does post but it posts null/empty data.

Not sure what the issue is but seems like it is not able to write or something, I installed the file plugin per your description.

I am also able to manually send push notifications and receive them in the app. Have to get the regId from the console log, not posting to server.

I unable to run this example

first clone the project than add all plugin else push notification. when i add the run cordova run android.
we see following error.

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 7.548 secs

Help me

Tap on Push Notification remove all push notification

Hi,
When I clicked it is clear all push notification form iOS push notification and How to stay rest of all push on tap of on any one push notification
How to make separated to its relevant data on particular page.

Thanks
Shivam

Can't get foreground notifications working on iOS

I am trying to get this working on iOS, however I can’t seem to find a way to make it get the handler to show a message when the app is in the foreground. I see the message is received in the Xcode console, but nothing happens within the app. I’ve tried a number of tracers on this and it just seems they are never fired.

Any thoughts? Is there perhaps an incompatibility with latest versions of something?

Cannot read property 'ecb' of null

TypeError: Cannot read property 'ecb' of null

Yeah, this is what I get when I run this project. The other files and plugins were well installed, but this error in console is still happening.

Cannot find module '../../package.json'

Hi there

When I try to add some of the required dependancies, while located at the project root, I get an error about problem finding package.json, it seems to be expecting it in the project root but it is not there.

Am I missing something?

...
Fetching plugin "https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git" via git clone
Running command: /Users/arnthorsnaer/Documents/PushNotificationSample/hooks/after_plugin_add/010_register_plugin.js /Users/arnthorsnaer/Documents/PushNotificationSample

module.js:340
    throw err;
          ^
Error: Cannot find module '../../package.json'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/arnthorsnaer/Documents/PushNotificationSample/hooks/after_plugin_add/010_register_plugin.js:7:19)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
Error: Hook failed with error code 8: /Users/arnthorsnaer/Documents/PushNotificationSample/hooks/after_plugin_add/010_register_plugin.js
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:194:23
    at _rejected (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:797:24)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:823:30
    at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1035:31)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:741:41)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:415:13)

iOS v 8,9 iphone 5,6 support

Hi,
The sample app was very helpful for understanding the plugin's functionality. I have just one question that is this plugin supported by ios v 4+ specifically for iphone 5,6 having version 9.
If not, can you please share some alternatives that supports all the platforms on all versions.

Build Failed on iOS

Hello @hollyschinsky, After following your given steps in my ionic app, the push notification plugin are successfully installed, When i build the ios project at that it will fail with given error:

/Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/BBlankApp/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m:55:50: warning: 'UIRemoteNotificationTypeNone' is deprecated: first deprecated in iOS 8.0 - Use UIUserNotificationType for user notifications and registerForRemoteNotifications for receiving remote notifications instead. [-Wdeprecated-declarations]
UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeNone;
^
In module 'UIKit' imported from /Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/build/emulator/include/Cordova/CDVAvailabilityDeprecated.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:68:5: note: 'UIRemoteNotificationTypeNone' has been explicitly marked deprecated here
UIRemoteNotificationTypeNone = 0,
^
/Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/BBlankApp/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m:64:34: warning: 'UIRemoteNotificationTypeBadge' is deprecated: first deprecated in iOS 8.0 - Use UIUserNotificationType for user notifications and registerForRemoteNotifications for receiving remote notifications instead. [-Wdeprecated-declarations]
notificationTypes |= UIRemoteNotificationTypeBadge;
^
In module 'UIKit' imported from /Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/build/emulator/include/Cordova/CDVAvailabilityDeprecated.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:69:5: note: 'UIRemoteNotificationTypeBadge' has been explicitly marked deprecated here
UIRemoteNotificationTypeBadge = 1 << 0,
^
/Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/BBlankApp/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m:71:30: warning: 'UIRemoteNotificationTypeBadge' is deprecated: first deprecated in iOS 8.0 - Use UIUserNotificationType for user notifications and registerForRemoteNotifications for receiving remote notifications instead. [-Wdeprecated-declarations]
notificationTypes |= UIRemoteNotificationTypeBadge;
^
In module 'UIKit' imported from /Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/build/emulator/include/Cordova/CDVAvailabilityDeprecated.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:69:5: note: 'UIRemoteNotificationTypeBadge' has been explicitly marked deprecated here
UIRemoteNotificationTypeBadge = 1 << 0,
^
/Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/BBlankApp/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m:80:34: warning: 'UIRemoteNotificationTypeSound' is deprecated: first deprecated in iOS 8.0 - Use UIUserNotificationType for user notifications and registerForRemoteNotifications for receiving remote notifications instead. [-Wdeprecated-declarations]
notificationTypes |= UIRemoteNotificationTypeSound;
^
In module 'UIKit' imported from /Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/build/emulator/include/Cordova/CDVAvailabilityDeprecated.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:70:5: note: 'UIRemoteNotificationTypeSound' has been explicitly marked deprecated here
UIRemoteNotificationTypeSound = 1 << 1,
^
/Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/BBlankApp/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m:87:30: warning: 'UIRemoteNotificationTypeSound' is deprecated: first deprecated in iOS 8.0 - Use UIUserNotificationType for user notifications and registerForRemoteNotifications for receiving remote notifications instead. [-Wdeprecated-declarations]
notificationTypes |= UIRemoteNotificationTypeSound;
^
In module 'UIKit' imported from /Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/build/emulator/include/Cordova/CDVAvailabilityDeprecated.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:70:5: note: 'UIRemoteNotificationTypeSound' has been explicitly marked deprecated here
UIRemoteNotificationTypeSound = 1 << 1,
^
/Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/BBlankApp/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m:96:34: warning: 'UIRemoteNotificationTypeAlert' is deprecated: first deprecated in iOS 8.0 - Use UIUserNotificationType for user notifications and registerForRemoteNotifications for receiving remote notifications instead. [-Wdeprecated-declarations]
notificationTypes |= UIRemoteNotificationTypeAlert;
^
In module 'UIKit' imported from /Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/build/emulator/include/Cordova/CDVAvailabilityDeprecated.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:71:5: note: 'UIRemoteNotificationTypeAlert' has been explicitly marked deprecated here
UIRemoteNotificationTypeAlert = 1 << 2,
^
/Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/BBlankApp/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m:103:30: warning: 'UIRemoteNotificationTypeAlert' is deprecated: first deprecated in iOS 8.0 - Use UIUserNotificationType for user notifications and registerForRemoteNotifications for receiving remote notifications instead. [-Wdeprecated-declarations]
notificationTypes |= UIRemoteNotificationTypeAlert;
^
In module 'UIKit' imported from /Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/build/emulator/include/Cordova/CDVAvailabilityDeprecated.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:71:5: note: 'UIRemoteNotificationTypeAlert' has been explicitly marked deprecated here
UIRemoteNotificationTypeAlert = 1 << 2,
^
/Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/BBlankApp/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m:109:26: warning: 'UIRemoteNotificationTypeNewsstandContentAvailability' is deprecated: first deprecated in iOS 8.0 - Use UIUserNotificationType for user notifications and registerForRemoteNotifications for receiving remote notifications instead. [-Wdeprecated-declarations]
notificationTypes |= UIRemoteNotificationTypeNewsstandContentAvailability;
^
In module 'UIKit' imported from /Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/build/emulator/include/Cordova/CDVAvailabilityDeprecated.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:72:5: note: 'UIRemoteNotificationTypeNewsstandContentAvailability' has been explicitly marked deprecated here
UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3,
^
/Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/BBlankApp/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m:116:30: warning: 'UIRemoteNotificationTypeNone' is deprecated: first deprecated in iOS 8.0 - Use UIUserNotificationType for user notifications and registerForRemoteNotifications for receiving remote notifications instead. [-Wdeprecated-declarations]
if (notificationTypes == UIRemoteNotificationTypeNone)
^
In module 'UIKit' imported from /Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/build/emulator/include/Cordova/CDVAvailabilityDeprecated.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:68:5: note: 'UIRemoteNotificationTypeNone' has been explicitly marked deprecated here
UIRemoteNotificationTypeNone = 0,
^
/Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/BBlankApp/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m:127:42: warning: 'registerForRemoteNotificationTypes:' is deprecated: first deprecated in iOS 8.0 - Please use registerForRemoteNotifications and registerUserNotificationSettings: instead [-Wdeprecated-declarations]
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes];
^
In module 'UIKit' imported from /Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/build/emulator/include/Cordova/CDVAvailabilityDeprecated.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:317:1: note: 'registerForRemoteNotificationTypes:' has been explicitly marked deprecated here

  • (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types NS_DEPRECATED_IOS(3_0, 8_0, "Please use registerForRemoteNotifications and registerUserNotificationSettings: instead");
    ^
    /Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/BBlankApp/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m:221:23: error: no visible @interface for 'UIView' declares the selector 'stringByEvaluatingJavaScriptFromString:'
    [self.webView stringByEvaluatingJavaScriptFromString:jsCallBack];
    ~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    10 warnings and 1 error generated.

** BUILD FAILED **

The following build commands failed:
CompileC build/BBlankApp.build/Debug-iphonesimulator/BBlankApp.build/Objects-normal/i386/PushPlugin.o BBlankApp/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/cordova/build-debug.xcconfig,-project,BBlankApp.xcodeproj,ARCHS=i386,-target,BBlankApp,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/Desktop/Ionic 2 Demo/BBlankApp/platforms/ios/build/sharedpch

my ionic info:
Cordova CLI: 6.1.1
Ionic Framework Version: 1.0.0-beta.13
Ionic CLI Version: 2.0.0-beta.24
Ionic App Lib Version: 2.0.0-beta.14
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Mac OS X Yosemite
Node Version: v5.10.1
Xcode version: Xcode 6.4 Build version 6E35b

how to solve it please help me.
Thank You !!

"notificationReceived" doesn't work after the first time

This app registers to GCM whenever user opens it, but this is not ideal as Registration ID will keep on changing after certain intervals. So, whenever the app is able to successfully store the Registration ID in the server, I am putting a variable in local storage to note it. After the successful restoration of registration ID, app won't register again.
But the problem is that if I am not calling $cordovaPush.register every time, "$cordovaPush:notificationReceived" is not being called. The notification stays in status bar, if I touch it nothing happens and app is not able to add it to $scope.notifications.

I unable to run this example

first clone the project than add all plugin else push notification. when i add the run cordova run android.
we see following error.

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 7.548 secs

Help me

Handling when user selects "Don't Allow" notifications

Using this code as a reference a while ago, I've been having problems with handling when user selects "Don't Allow". My code receives no callbacks and as I understand this is a known issue. Have you done any workarounds on this in this sample project?

Error running app on Android

This is what I get when I run the app, then click register.
Yes I have changed the GCM ID and URLs in controller.js

03-08 20:05:26.618    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:26.625    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:26.698    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:26.698    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:26.711    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:26.716    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:26.762    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:26.762    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:26.771    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:26.775    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:26.815    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:26.815    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:26.826    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:26.832    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:26.856    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:26.857    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:26.866    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:26.882    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.091    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.091    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.108    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.117    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.173    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.173    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.181    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.185    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.241    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.241    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.249    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.253    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.298    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.298    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.309    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.313    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.387    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.388    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.398    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.404    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.448    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.448    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.455    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.461    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.504    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.504    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.513    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.517    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.572    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.572    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.582    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.586    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.638    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.638    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.645    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.652    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.692    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.692    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.707    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.713    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.763    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.763    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.767    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.774    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.793    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.793    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.802    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.808    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.827    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.827    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.837    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.842    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.853    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.854    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.857    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.870    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.880    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.880    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.887    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.893    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.911    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.911    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.920    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.924    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.935    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.935    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.945    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
03-08 20:05:27.950    2303-2303/co.gandc.notify D/CordovaActivity﹕ onMessage(spinner,stop)
03-08 20:05:27.953    2303-2373/co.gandc.notify E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
03-08 20:05:27.972    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:27.972    2303-2373/co.gandc.notify E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
03-08 20:05:45.001    2303-2303/co.gandc.notify D/CordovaLog﹕ file:///android_asset/www/lib/ionic/js/ionic.bundle.js: Line 17696 : TypeError: Cannot read property 'pushNotification' of undefined
            at Object.register (file:///android_asset/www/lib/ng-cordova.js:4484:36)
            at Scope.$scope.register (file:///android_asset/www/js/controllers.js:33:22)
            at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:18471:21
            at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:43026:9
            at Scope.$eval (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:20326:28)
            at Scope.$apply (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:20424:23)
            at HTMLButtonElement.<anonymous> (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:43025:13)
            at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:10478:10
            at forEach (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:7950:18)
            at HTMLButtonElement.eventHandler (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:10477:5)
03-08 20:05:45.001    2303-2303/co.gandc.notify I/chromium﹕ [INFO:CONSOLE(17696)] "TypeError: Cannot read property 'pushNotification' of undefined
            at Object.register (file:///android_asset/www/lib/ng-cordova.js:4484:36)
            at Scope.$scope.register (file:///android_asset/www/js/controllers.js:33:22)
            at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:18471:21
            at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:43026:9
            at Scope.$eval (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:20326:28)
            at Scope.$apply (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:20424:23)
            at HTMLButtonElement.<anonymous> (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:43025:13)
            at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:10478:10
            at forEach (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:7950:18)
            at HTMLButtonElement.eventHandler (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:10477:5)", source: file:///android_asset/www/lib/ionic/js/ionic.bundle.js (17696)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.