Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Notifications.js #1

Open
pasza01 opened this issue Aug 15, 2017 · 15 comments
Open

In Notifications.js #1

pasza01 opened this issue Aug 15, 2017 · 15 comments
Assignees

Comments

@pasza01
Copy link

pasza01 commented Aug 15, 2017

In Notifications.js change line 44 with your api key

Which api key should I use. Server key or legacy server key?

I tried both. It doesn't work. Am I missing something?

@LuisRodriguezLD
Copy link
Owner

Hello, I use the Legacy key.
Please note that it must have key= before the actual key.
Eg. 'Authorization' : 'key=000000000000000000000000000000000000000'

Also, just a reminder: This is for testing only, if you want to use this on a Release build you will need a couple of changes. https://github.com/LuisRodriguezLD/Fuse-Firebase-Notifications#important-ios

@pasza01
Copy link
Author

pasza01 commented Aug 15, 2017

Did the legacy server. Enable push on xcode still no success. Sandbox is true, because i am testing internally. for certificate, I uploaded .p8 certificate. A lot of certificate don't know which one to use.

@LuisRodriguezLD
Copy link
Owner

LuisRodriguezLD commented Aug 15, 2017

Ah, apparently Firebase edited some of the documentation.
And it now prefers Keys rather than certificates.
I will update this repo soon but it still works, just follow this steps.
The certificate you need is a .p12 file.

  1. Create a Push Notification certificate from the Developer page (https://developer.apple.com/account/ios/certificate/create)

  2. Select Apple Push Notification service SSL (Sandbox & Production)

  3. Choose your App Id (This must match your Fuse Project)

  4. Create a Certificate Signing Request (CSR) (Just follow the instructions on screen)

  5. Upload your .CSR file generated in step 4

  6. Apple will sign it, download that file. Open it and It will be added to your Keychain.

  7. Go to that certificate on Keychain, right click on it and export it. That file will be a .p12 file. Upload to Firebase under Settings - Cloud Messaging; choose your app and select APNs Certificates. Use the same certificate for Development and Production.

Please let me know if you have any additional questions.

@pasza01
Copy link
Author

pasza01 commented Aug 15, 2017

still not working. followed every steps. Do i have to do anything on xcode?

@LuisRodriguezLD
Copy link
Owner

This is interesting. Maybe something else changed.
Could you please post the console log you get from Xcode?

@pasza01
Copy link
Author

pasza01 commented Aug 15, 2017

2017-08-15 14:37:24.259468-0500 nsatlm[15211:3021455] [DYMTLInitPlatform] platform initialization successful
2017-08-15 14:37:24.398343-0500 nsatlm[15211:3021280] libMobileGestalt MobileGestaltSupport.m:153: pid 15211 (nsatlm) does not have sandbox access for frZQaeyWLUvLjeuE3hmg and IS NOT appropriately entitled
2017-08-15 14:37:24.398486-0500 nsatlm[15211:3021280] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see rdar://problem/11744455)

@LuisRodriguezLD
Copy link
Owner

LuisRodriguezLD commented Aug 15, 2017

This not an issue with the repo nor Fuse.
Apparently there is a huge thread regarding that specific issue -> https://forums.developer.apple.com/thread/72286

Probably related to certificates or signing.
To be honest I don't know but you could try:

  1. In Xcode, go to settings, accounts and download all profiles
  2. Clean Xcode, cmd + shit + k
  3. Close Xcode
  4. In Fuse, uno clean and rebuild

Again, not sure what causes it and apparently a lot of users are seeing it.
Sorry I can't help much on that area.
Send me PM on Fuse's slack, I can give you a hand there.

I'll keep this open until I update it to use Keys instead of Certificates.

@pasza01
Copy link
Author

pasza01 commented Aug 15, 2017

Finally, it works. But notification doesn't show up in notification bar. only shows text after running

@LuisRodriguezLD
Copy link
Owner

I'm glad it worked. Could you share your solution for future problems?
About the notification, it will only reach the notification center if the app is out of focus. If the app is open the notification will be delivered in a JSON format, then you can create your own notification.

More on that: https://www.fusetools.com/docs/fuse/pushnotifications/push#the-notification

@pasza01
Copy link
Author

pasza01 commented Aug 15, 2017

my bad it not working. Works for device with device token only. I tested with NWPusher which was on fusetools docs. I think the APNtoFCM() never runs. Sorry for the confusion

@pasza01
Copy link
Author

pasza01 commented Aug 15, 2017

I am confused with this fetch

fetch("https://iid.googleapis.com/iid/v1:batchImport", options)
.then(function(response) {
return response.json();

Don't we have to add device token before importing? or I am completely lost

@pasza01
Copy link
Author

pasza01 commented Aug 17, 2017

I keep getting invalid fcm token even though the above code you provided print out long string of FCM token.

@LuisRodriguezLD
Copy link
Owner

Sorry for the delay. That fetch transforms the Apple Push Notification token and transforms it into Google Cloud messaging token.

Here is more info on that API -> https://developers.google.com/instance-id/reference/server#create_registration_tokens_for_apns_tokens

You can also take a look at the very bottom on that page, there are errors and their definitions.

@pasza01
Copy link
Author

pasza01 commented Aug 23, 2017

Hi,
Thanks for the info. Is there a way you could run this project again and confirm it still works or not on firebase. If this work for you. I will be sure I messed up somewhere and will work into it. Please

@LuisRodriguezLD
Copy link
Owner

Interesting, I can't get it to work either. Changing this to bug, I will check what's going on. It was working, maybe Firebase changed something (?).

Or maybe I missed something..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants