Firebase dynamic links are working well both after installation and whenever the app is in the background.
However, if it's coming from the inactive state (app is closed), it doesn't work. Both applicationOpenURL and applicationUserActivity is not being called.
Anybody experienced this before? I've been trying to solve this for days now, back and forth with Firebase's tutorial. I'm sure I'm just missing something here.
Put this in didFinishLaunchingWithOptions
//Handle dynamic links when app is CLOSED
let activityDic = launchOptions?[.userActivityDictionary]
if let isActivityDic = activityDic {
// Continue activity here
return true
}
it will call continue userActivity if the app is opened from CLOSED state.
Related
I'm using React native 0.65.1 and "#react-native-firebase/messaging": "12.8.0", and have messaging().getInitialNotification() listener for cases that the app opened from quit state by notification.
Besides that, I have multiple languages in the app, and in case a user changes his language from RTL to LTR (or the other way around...), I'm calling
import RNRestart from 'react-native-restart'
RNRestart.Restart()
The problem is, that in case the user started the current session of the app (only from a quit state) by a notification, if he will change the language in the same session in a way that causes refresh, the getInitialNotification listener will be fired again (with navigation or UI manipulation that's not needed).
Searched through the docs if there's any way to delete a message after the first time of listener runs, couldn't find any, and don't have any other idea how to encounter this issue (open as well for a suggestion on how to fix it from the other end of Restart, if someone has an idea how to switch from RTL to LTR in another way or with equivalent method/library that won't cause this issue).
(onNotificationOpenedApp (from background state) and onMessage (on foreground state) don't create this issue...)
Thanks in advance :)
I am using firebase realtime database and I have a multi path firebase update query that I was using for a while, however for last couple of days the callback never fires and other firebase database requests are blocked as well until this one fires. Callback takes incredibly longer to fire than it should or it used to. And most interestingly this issue does happen on Windows environment only.
let updateObj = {}
updateObj[`transcripts/${uid}/${itemId}/currentState`] = currentState
updateObj[`lists/${uid}/${itemId}/edited`] = firebase.database.ServerValue.TIMESTAMP
updateObj[`lists/${uid}/${itemId}/filename`] = title
db.ref().update(updateObj, function(error){
//handle error
}
I thought it could possibly be because another reference is initialized at the same path later on but callback sometimes hangs even before that.
updateObj[`transcripts/${uid}/${itemId}/currentState`] = currentState
variable currentstate above has a somewhat of a big array node inside so I also think the array might be the issue considering they don't really work that efficiently with firebase realtime database.
Commenting this out solves all the problem but I am still clueless how this suddenly started to break firebase realtime database for me.
When a user registers on my system, I create the user internally, and then allow the user to register with Firebase using the firebase client lib. This generates a session token for the user. Later, when a user starts the app again, the app automatically logs the user in like this:
ref.authWithCustomToken(sessionToken, function(error, authData) {...
debugger
I have verified that the sessionToken is available when the function is executed, but debugger is never reached, and no error is ever emitted.
Any help is appreciated!
I know it's a bit late, but I experienced a similar problem and it had me scratching my head for a while, so just in case it helps somebody else, here's what I found.
If I run authWithCustomToken with a token generated with one uid (uid1) and then run it again on the same ref with a different uid (uid2), the callback doesn't get fired the second time around.
In my case, I had declared the same ref in different modules that were used in the same node process and was trying to authenticate them with different uids. Although I had declared the ref twice, Firebase still saw it as the same ref because it was in the same process and referred to the same Firebase location. By declaring and authorising the ref in a parent module, I was then able to use onAuth in the child modules and the onAuth callbacks all fired as expected.
I had a similar problem with iOS, authWithCustomToken callback was never called right after install.
All consecutive launches worked fine.
My findings might be related so I thought I share them.
Problem was I called
func applicationWillResignActive(application: UIApplication) {
Firebase.goOffline()
}
func applicationWillEnterForeground(application: UIApplication) {
Firebase.goOnline()
}
in AppDelegate. Turns out if you call Firebase.goOnline() without logging in first it messes up the callback. Once I removed those two lines everything worked fine.
It has been stated that an app running a HKWorkoutSession will have special privileges over other watchOS 2 apps, so when a user looks at their Apple Watch, it will go to the view showing running a workout rather than the watch face.
Currently, on both my device and simulator, this is not the case. If I start a HKWorkoutSession and then leave for 5 minutes and then interact with either the Apple Watch, or the Watch Simulator, it presents the watch face.
If I then open my app, it appears to have been frozen, rather than terminated (which is what I imagine happens to other apps). As the UI will update when I need receive a response in my query.updateHandler. Also if I set it to provide haptic feedback every time my query.updateHandler receives a new HKQuantitySample it will do so, so the app must be running in the background in some form.
Has anyone else noticed this behaviour, and am I doing anything wrong, or expecting something I shouldn't?
Here is how I start my HKWorkoutSession:
self.workoutSession = HKWorkoutSession(activityType: HKWorkoutActivityType.Other, locationType: HKWorkoutSessionLocationType.Indoor)
self.healthStore.startWorkoutSession(self.workoutSession) {
success, error in
if error != nil {
print("startWorkoutSession \(error)\n")
self.printLabel.setText("startWorkoutSession \(error)")
self.printLabel.setTextColor(UIColor.redColor())
}
We're seeing that too, for the moment we've made sure 'opens last activity' is configured.
When the UI is active we start a dispatch_timer to request and process data in 1 second intervals.
Make sure you do any significant processing using the NSUserProcessInfo method though and pause the dispatch_timers whenever you are no longer active. You'll get crashes otherwise.
I know I can manually go to status.firebase.com but I need to be alerted immediately when my firebase app goes down and when it comes back up.
I thought I could possibly use dingitsup.com to send myself a notification, but i don't know where to point it.
I would also like to have the option of automatically displaying a message to my users when Firebase is down to let them know the system is down and its not a problem on their end. Is there a Zapier integration i could use to achieve this?
Any help would be great! Thanks
Programmatically, you could use a service like Pingdom to send yourself a notification, and could ping an endpoint on your-firebase.firebaseio.com/some-public-endpoint.json.
Also, #FirebaseStatus is a good resource actively updated by the Firebase folks.
Could you write something to use the connection state?
https://www.firebase.com/docs/managing-presence.html (broken)
new link: https://firebase.google.com/docs/database/web/offline-capabilities
I use something similar in my apps to detect if the user has a connection, and display a notice if they don't.
I just figured a way
Firebase.enableLogging(function(logMessage) {
if(logMessage && logMessage.indexOf("Long-poll script failed to load") !== -1 && navigator.onLine){
console.error('Its dead Jim! Firebase seems to be down for this user');
}
});
I'm not sure how firebase works under the hoods but I've seen users connected in a previously open tab and if they open a new tab firebase won't connect when it's down.
This logging function is called a lot, and when firebase is down our console.error will be call every ~5s or something.
Make sure to debounce whatever you'll do in the console.error's place.