I have push notifications setup for my app and it’s corresponding App Clip. Let’s say that the App has an AppID, com.X and the App Clip has the ID com.X.Clip.
I set the topic of the aps to com.X.Clip to send push notifications to my App Clip and it works properly. However, when I try to send push notifications to my App, I get the error DeviceTokenNotForTopic because the device token is for the AppClip and not for the app. Fixing the topic to com.X, solves the problem.
My question is, is there a way to set the topic to something common that can be shared by my App and the AppClip so that I don’t receive these errors? Otherwise I would have to also store which device tokens are for the app and which are for the clip which will increase storage costs.
Or perhaps there is another way?
Not sure if you figured it out, but I just asked a similar question here: How do I detect whether an iOS App Clip or Universal Link is running?
You can't combine them, but you can tell your server where to register the device token.
Related
This bounty has ended. Answers to this question are eligible for a +500 reputation bounty. Bounty grace period ends in 5 hours.
Scorb wants to draw more attention to this question.
I have a cross platform flutter app. I am using FCM to send notifications and they are not arriving on the iOS app in any state (foreground, background, terminated). I am testing on a physical device.
The notifications work on Android, so I know the topic subscription and send code is correct.
I have followed these steps for configuration defined here...
https://firebase.flutter.dev/docs/messaging/apple-integration/
To verify I have:
added and initialized firebase using google-services-info.plist.
created and added my APNS key
created the app identifier in the Apple Developer center and confirmed it matches my apps bundle id (and added push notification
capability for the identifier.
added push notification capability to the app in xcode
added background fetch and background remote notification capabilities to the app in xcode.
It seems like I have addressed every step to configure FCM on iOS. But none of my notifications arrive.
When the app is minimized, no system tray notification is triggered, and when in the foreground the FirebaseMessaging.onMessage is never triggered, like is is when on Android.
An important note is that this is the second iOS app added to this project, and the first iOS app works correctly. Though there is no indication that there are any special steps for a second app.
We saw a similar problem (for a native iOS app) where FCM would deliver to one app in the project but not the other. The mistake we made was not repeating the configuration in Firebase for the other apple bundle id since each app in our project has a different bundle id. Given it works for one of your iOS apps but not the other on the same project, it sounds like you've got the same issue.
Also, a good diagnostic step is to use the Firebase Console to manually send off a Push Notification to a particular app. It means you can then discount errors further upstream in your backend that may not have caused FCM to be invoked.
Have you tried to send testing notifications via firebase console?
You can log your device token in your app.
Background notification must work if you have done correct with firebase and APN settings despite without implementing some methods of AppDelegate file for remote notification on the next step.
Your question is very blur to have a specific answer but you can separate your concerns to find the issue and then try to resolve that:
1. Make sure about the APNs configuration
First, try to send a notification to your iOS app, directly using the APNS key. If you get the notification, it means you have configured the APNS correctly
2. Make sure about the firebase setup
Check with both the Android and iOS app and see if there are connected to the firebase console. You can use the real-time event to confirm that.
3. Make sure you have implemented the correct methods.
Firebase and apple have different methods for push notifications. Make sure you are implementing the correct one. Also, it may vary based on the configuration file of firebase. search for iOS firebase swizzling for more information
4. Make sure you got the right permissions from the user
You should get the notification permission from the user before trying to show any notification. Make sure you've done that
Note that you may have already tried some of these but I've mentioned them for the sake of completeness. Hope it helps you and others.
I am not very familiar with push notifications. But is it possible to send push notification from one app to another? I know you need a server to send notifications but is it possible implement that in an app.
Short answer: No, pushes are sent from a server to a server.
Long answer: Of course, it's not common practice, but lots of fun.
To send out a push notification to an Apple device, you will need to connect with the APNS server and then send your notification in data format. Although this is usually done from a server, it can just as well be done from an iPhone or iPad.
If you want to get going yourself, I recommend reading all the documentation Apple provides on this topic (start here). Everything you need to know is in there, but you will need to pay attention to the details in order to get this to work.
An easier way to get going is by using NWPusher. This is an iOS framework that provides all the tools you need to push from iOS to iOS. It even includes an iOS demo app that does this:
NWPusher - Push from iOS
Just a small warning: In order to push from iOS, you will need to include the push certificate and private key in the app bundle. This is not a secure place to keep such a private key and you definitely don't want your app's push certificate to leak.
Enjoy!
I have a web app which I need to send apple push notifications to. I was thinking if I set up a login screen specifically for the web view to point to, which included a request for the device UUID on post, for the purpose of apple push notifications. So can you ask the device for its UUID from a page being viewed in ui.webview?
There are a couple of things wrong with your question. Firstly apple deprecated the UDID, which was never used for push notifications anyway. You get a push token when you sign up for push notifications.
Secondly you can't send push notifications to a web app or a webpage running in an iOS app, you need to implement this in objective-c in an iOS app. There is no other way around it.
I suggest you read the apple docs / tutorials on this as there is a lot to learn. Heres the main overview: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction.html
I have been looking at the "find my iPhone" app and it seems like it is using iCloud and no push notification to receive a alertView about a notification. By having some mechanism in the background running and alerting the user once it receives a notification.
What I am wondering is that is this app a special exception Apple made for this app, and all other apps have to do push notification? Or can I make an app that runs in the background just like the "find my iPhone" app and communicate via iCloud.
Thank you in advance.
Apple uses iCloud for Find My iPhone, yes, but I believe their reason for this is tying it to your iCloud account so that if your phone is stolen, you can log in your account at icloud.com to attempt to track it. The Find My iPhone app itself works by pinging the GPS location, saving that location, and syncing it with iCloud. For general developer use however, there's no direct API for communicating via iCloud, nor is it likely there will be. iCloud's main purpose is synchronization and backup, and since Apple already has the Push Notification service in place it wouldn't make sense at this point to put that in iCloud. What functionality are you wanting that Apple's Push doesn't allow?
When your app is in the foreground you have the capability of receiving data from an external source a number of different ways. However when your app is terminated either by the user or the system memory watchdog, Push Notifications are the only real route. So at this stage, integrating the APNS is your best solution. There's a few great services that make APNS integration relatively painless, such as Urban Airship.
I have an iOS app with a Rails backend (and frontend). I am using Parse for push notifications.
I am trying to figure out the best way to only send push notifications that will be received; that is, I want to avoid sending them to:
Users who only use the web app and don't have the iOS app
Users who had the iOS app but then uninstalled it
The way that the Parse Push API works is that I can broadcast a notification on a certain channel, and any device that is listening to that channel will receive the notifications. Therefore, I am planning to make separate channels for each user.
Obviously, I am going to need to store some sort of information on the server side about who is running the iOS app. I'm curious as to whether anyone out there has experience solving a problem like this and can offer any wisdom. Thanks!
Parse already stores information about who is running iOS and Android apps. Check out the Data Browser, there is an Installation table with a deviceType field.
Have the iOS app register a unique (per-user) channel. If you're only sending push notifications on user channels, it will only be sent to users who have installed the iOS app.
There's not much you can do for users who had the iOS app but uninstalled it. Apple doesn't provide a way for applications to run any code before being uninstalled, so you can't unregister the device with Parse. I'm not sure if Parse does this, but Urban Airship polls the APNS servers and removes devices that have had the app uninstalled after a certain amount of days.