Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Utilizing push plugin #91

Closed
tgale96 opened this issue Aug 31, 2015 · 5 comments
Closed

Utilizing push plugin #91

tgale96 opened this issue Aug 31, 2015 · 5 comments

Comments

@tgale96
Copy link

tgale96 commented Aug 31, 2015

As someone who is new to phonegap, and mobile app development in general, the documentation does not really provide any tips on how to actually use the plugin. I added it to my project as the docs say to do, and I added it to my config.xml. However, after that I really had no idea how to gain access to the APIs.

I copied the push.js file into my project and included it in my index.html, then I tried to reference the PushNotification class from my index.js but when I ran the app on my phone (using phonegap app and phonegap server) I got an error

"TypeError: undefined is not a function (evaluating 'PushNotification.init({ "android": {"senderID": "123456789"}, "ios": {}, "windows": {} })')"

It would be very nice if you could expand the documentation to explain exactly how you should gain access to the API in your app.

Thanks,
Trevor

@macdonst
Copy link
Member

macdonst commented Sep 1, 2015

@tgale96 the PhoneGap developer app does not include the push plugin code. The developer app is built with a number of core plugins like geolocation, camera, etc. but push is not currently one of them.

You don't need to add the push.js file to your HTML file. If you add it to your project using the CLI it will be taken care of for you.

Also, did you wait for the "deviceready" event before trying to call "init"?

@tgale96
Copy link
Author

tgale96 commented Sep 1, 2015

Oh very nice! Thanks!

Any idea on what I should put for SenderId if I don't plan on using gcm?

Thanks,
Trevor

On Aug 31, 2015, at 10:28 PM, Simon MacDonald [email protected] wrote:

@tgale96 the PhoneGap developer app does not include the push plugin code. The developer app is built with a number of core plugins like geolocation, camera, etc. but push is not currently one of them.

You don't need to add the push.js file to your HTML file. If you add it to your project using the CLI it will be taken care of for you.


Reply to this email directly or view it on GitHub.

@macdonst
Copy link
Member

macdonst commented Sep 1, 2015

@tgale96 ignore it. If you don't ever run on Android then the options for Android will never be read.

@tgale96
Copy link
Author

tgale96 commented Sep 1, 2015

Yes, I have the PushNotifications instance occurring once the device ready event is registered. Thanks for the help! I will try to get it running on my phone through xcode.

@tgale96 tgale96 closed this as completed Sep 1, 2015
@lock
Copy link

lock bot commented Jun 5, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants