push-notification

Play song in Notification

本小妞迷上赌 提交于 2021-01-29 05:30:07
问题 I want to play a song. When a notification comes. My code is working fine when the app is foreground mode. I want to play a song when the app is in background mode. Please help. 回答1: Add custom sound to your local notification Swift 3.0 func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) { var state: UIApplicationState = application.applicationState if state == .active { var soundID: SystemSoundID var mainBundle: CFBundleRef =

Desired activity not open while clicking on notification FCM

依然范特西╮ 提交于 2021-01-29 02:31:11
问题 I am doing a demo on FCM where if i click on notification it should go to notification class and show the notification message. But whenever I click notification it always redirect to default launcher activity i.e MainActivity. I have seen so many duplicate question like me but no where proper solution. Whatever solution I have found I have tried those also not working. Please look into my intent code and let me know where I have done mistake or I am missing anything else to add anything in

SwiftUI 2 Firebase push notification

人盡茶涼 提交于 2021-01-28 13:30:33
问题 So, I am building iOS app with SwiftUI 2 and new Application life cycle, trying to implement AppsDelegate and Firebase push notification here my codes sample import SwiftUI @main struct App: App { @UIApplicationDelegateAdaptor(AppDelegate.self) var delegate var body: some Scene { WindowGroup { ContentView().environmentObject(AppSettings()) } } } and AppDelegate import Firebase import FirebaseMessaging import UserNotifications import Foundation import UIKit class AppDelegate: NSObject { let

handling local push notifications when app is in the background

橙三吉。 提交于 2021-01-28 11:12:34
问题 In iOS 10, I see that there are two functions for handling local push notifications: func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) and func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) The first is invoked when a push

FCM push notification not received when app is killed/swiped out

前提是你 提交于 2021-01-28 11:08:43
问题 I am migrating notification to FCM from GCM. In GCM, I was able to receive notification when app was in foreground, background or killed, but in FCM, I am not able to receive notification when app is not opened/killed by swipe out. Am I missing anything???? AndroidManifest.xml <service android:name=".Services.ExtendedInstanceIDListenerService" android:exported="false"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT" /> </intent-filter> </service> <service android

Changing application server key in push manager subscription

随声附和 提交于 2021-01-28 10:50:35
问题 I implemented web push notifications using service worker. I collected user subscriptions with a particular application server key. Suppose if we change the application server key, then when we get the subscription using "reg.pushManager.getSubscription()", we will get the old subscription information which was created using the old application server key. How to handle this scenario? How to get the new subscription from the user? 回答1: Get the subscription using reg.pushManager

Changing application server key in push manager subscription

早过忘川 提交于 2021-01-28 10:43:18
问题 I implemented web push notifications using service worker. I collected user subscriptions with a particular application server key. Suppose if we change the application server key, then when we get the subscription using "reg.pushManager.getSubscription()", we will get the old subscription information which was created using the old application server key. How to handle this scenario? How to get the new subscription from the user? 回答1: Get the subscription using reg.pushManager

How to add different actions depending on the category defined in incoming remote notification payload? Swift UPDATED

时光怂恿深爱的人放手 提交于 2021-01-28 07:51:10
问题 I'm implementing push notifications in my two related apps and so far I'm able to send a notifications, device to device, and to a topic. On receiving it, notification displays the image at url sent with the payload. My goal is to add actions to the topic notifications, and they would be different for each topic. Ej. actions for "shop-promotions" topic notifications (namely "buy" ) would be different from "news" topic notification ( namely "play" ). So I thought to send a "category" parameter

open specific activity when e push notifications from firebase

巧了我就是萌 提交于 2021-01-28 07:07:51
问题 I have android application and tried to receive a push notifications. My problem when click the reserved notification open the main activity, I need when received push notifications from firebase open a specific activity directly. This is my code public class MyFirebaseMessagingService extends FirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage remoteMessage) { super.onMessageReceived(remoteMessage); Log.d("msg", "onMessageReceived: " + remoteMessage.getData().get

Android app doesn't show pop up notification sent from Cloud Functions

浪尽此生 提交于 2021-01-28 06:45:57
问题 I create an app chat with firebase realtime db, I'm doing add friend step, I want to show a notification when user click add friend. I used the firebase function. Everything works fine but my device still not show notification. I really don't know while. Can someone help me? My index.js to deploy on firebase: 'use strict' const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); exports.sendNotification =