remote-notifications

iOS / FCM - How to use Image name from Payload to display an Image from XCAsset folder as Notification Attachment?

不想你离开。 提交于 2019-12-08 17:13:54
问题 I am working on Rich Notification for a Weather App which is sent via FCM. First of all, I would like to inform you that my notifications are sent and received successfully both with APNS and FCM. I am using Pusher and Postman in order to test everything. CONTEXT Here is the Payload I am sending through Postman { "to": "/topics/03772", "content_available": true, "mutable_content": true, "priority": "high", "notification": { "title": "Daily forecast", "body": "Blue sky, no clouds", "sound":

UNNotificationServiceExtension sometimes doesn't show image

╄→гoц情女王★ 提交于 2019-12-08 06:07:14
问题 I created subclass of UNNotificationServiceExtension to show remote attachment in notification. Randomly, attachment doesn't show. Issue is hard to reproduce, but some users reported, that after receive remote notification with image attachment, they can't see image. After some debugging, I encountered this issue once. I noticed that downloadTask() had empty location but response 's status code was 200 . override func didReceive(_ request: UNNotificationRequest, withContentHandler

How to clear the remote notification in your app?

最后都变了- 提交于 2019-12-03 05:30:19
Is there a way to clear the remote notification from the notification banner when swiping down from the top of the iPhone screen. I tried setting the badge number to zero: application.applicationIconBadgeNumber = 0 in delegate didFinishLaunchingWithOptions , and didReceiveRemoteNotification , but it did not clear the notifications. Thanks. Icaro You need to set the IconBadgeNumber to 0 and cancel the current notifications. I never did in swift but I think the code for it would be as bellow: application.applicationIconBadgeNumber = 0 application.cancelAllLocalNotifications() In iOS 10, above

How to detect Remote notification in didFinishLaunchingWithOption application method in objective c?

余生颓废 提交于 2019-12-02 09:36:34
when app in not in background mode ,inactive mode and app is completely closed. than how to detect is their any notification using application's delegate "didFinishLaunchingWithOption" method. i have searched a lot about it but not get anything. please help . Thanks Below methods is used for notifiaction - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]; if (notification) { } } -(void)application:(UIApplication *

Using URLSession and background fetch together with remote notifications using firebase

心已入冬 提交于 2019-12-02 05:16:24
I am trying to implement a basic func here which will be called when my app is backgrounded or suspended. In reality, we aim to send about 5 a day so Apple should not throttle our utilisation. I've put together the following which uses firebase and userNotifications, for now, it is in my app delegate. import Firebase import FirebaseMessaging import UserNotifications @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var backgroundSessionCompletionHandler: (() -> Void)? lazy var downloadsSession: Foundation.URLSession = { let configuration =

How to change how a remote notification is presented before presentation?

馋奶兔 提交于 2019-12-01 14:00:01
问题 How should I change how a remote notification is presented in iOS before the system presents it? In fact, silence it. There are times where my app has canceled a Firebase topic subscription locally, but that cancellation is not delivered to the server in time. So, when our app is not running(in the background OR NOT RUNNING AT ALL), the server would still send a message to that Firebase topic and iOS will receive it. My question is, how can I intercept a notification, and check whether it

How to enable/disable push notification from the app?

无人久伴 提交于 2019-11-29 19:34:19
In my app I want to enable/disable push notification from the settings page of my app itself.Can any one suggest me a solution to turn on/off the status of app in notification center from the app ? you can register and unregister the remote notification with bellow code. Register RemoteNotification with bellow code..means Enable notification //-- Set Notification if ([[UIApplication sharedApplication]respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) { // For iOS 8 and above [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings

How to enable/disable push notification from the app?

时间秒杀一切 提交于 2019-11-28 15:09:14
问题 In my app I want to enable/disable push notification from the settings page of my app itself.Can any one suggest me a solution to turn on/off the status of app in notification center from the app ? 回答1: you can register and unregister the remote notification with bellow code. Register RemoteNotification with bellow code..means Enable notification //-- Set Notification if ([[UIApplication sharedApplication]respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) { // For iOS 8 and

Should I update my app upon receiving payload? Or I should always update it by allowing it to download for itself?

偶尔善良 提交于 2019-11-28 08:10:06
问题 When your iPhone receives a WhatsApp/Telegram push notification e.g. wife: "buy pizza" Question1: Is it that the app has to download/receive that itself . That is the banner that pops up on the phone has to download for itself + my Whatsapp/Telegram has to download again for itself? My friend replied: Push notifications can have the message as a payload. Your app could extract that and dynamically insert into the conversation without making an additional request - I've done that before. Makes

didReceiveRemoteNotification function doesn't called with FCM notification server

混江龙づ霸主 提交于 2019-11-27 08:36:09
问题 I'm using FCM server for remote notifications, it worked perfectly with sending and receiving notifications. My problem is when the device is in the background, this function func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) doesn't called. Solutions that I've tried: This function: userNotificationCenter(_ center: UNUserNotificationCenter, didReceive