You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_The following sections are applicable to Android only_
78
+
79
+
### Single-Sampling
80
+
81
+
This makes sure Android doesn't resolve the getTimeSinceStartup promise more than once per app execution. More information in [PR #10](https://github.com/doomsower/react-native-startup-time/pull/10).
75
82
76
-
_This section is applicable to Android only_
83
+
Since v1.4.0 this strategy is enabled by default, if you're migrating from a previous version and you just want things to keep working as they are, follow the steps below.
77
84
78
-
In case you're going to use this library for collecting the performance analytics, be aware to discard redundant samples which may sometimes pop up.
85
+
#### Disabling Single-Sampling:
79
86
80
-
Depending on which lifecycle hook you've attached your call to `getTimeSinceStartup()` you might receive redundant invocations, e.g. when the app is brought from bg to fg. Because the app isn't really starting up, the measured time can be unrealistic; such unrealistic samples adulterate your data and should be avoided.
87
+
Be aware, depending on which lifecycle hook you've attached your call to `getTimeSinceStartup()` you might receive redundant invocations, e.g. when the app is brought from bg to fg. Because the app isn't really starting up, the measured time can be unrealistic; such unrealistic samples adulterate your data.
81
88
82
-
To enforce single-sampling strategy, create your package using constructor with parameter `true`:
89
+
To disable single-sampling strategy, create your package using constructor with parameter `false`:
83
90
```java
84
91
// Define package
85
-
newRNStartupTimePackage(true)
92
+
newRNStartupTimePackage(false)
86
93
```
87
-
then sample the startup time with catching the redundant invocation error:
0 commit comments