Skip to content

Commit 601b3eb

Browse files
committed
Add documentation on how to warmup the browser process in Android
1 parent 6a457bd commit 601b3eb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,33 @@ import { InAppBrowser } from 'react-native-inappbrowser-reborn'
230230
...
231231
```
232232

233+
### Android Optimizations
234+
235+
On Android, you can warmup the in app browser client to make it launch siginificantly faster. To do so, add the following to your `MainActivity`
236+
237+
```java
238+
import com.proyecto26.inappbrowser.RNInAppBrowserModule;
239+
240+
public class MainActivity extends ReactActivity {
241+
242+
@Override
243+
protected void onStart() {
244+
super.onStart();
245+
RNInAppBrowserModule.onStart(this);
246+
}
247+
248+
}
249+
```
250+
251+
You can further optimize performance and pre-render pages [by providing the urls that the user is likely to open](https://developer.chrome.com/docs/android/custom-tabs/best-practices/#pre-render-content).
252+
253+
```javascript
254+
// Do not call this every time the component render
255+
useEffect(() => {
256+
InAppBrowser.mayLaunchUrl("Url user has high chance to open", ["Other urls that user might open ordered by priority"]);
257+
}, []);
258+
```
259+
233260
### Authentication Flow using Deep Linking
234261

235262
In order to redirect back to your application from a web browser, you must specify a unique URI to your app. To do this,

0 commit comments

Comments
 (0)