mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-19 13:08:21 +08:00
Update docs to match module rename
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
---
|
||||
title: Android Setup | App Indexing
|
||||
description: Setup your Android application to handle app indexed URLs.
|
||||
---
|
||||
|
||||
# Android Manual Linking
|
||||
|
||||
Your Android application needs to be setup to detect whether URLs which a user navigates to on your device are to be
|
||||
handled by your application.
|
||||
|
||||
To set this up, add a new `intent-filter` to your manifest file. The example below will trigger the app indexing module
|
||||
to handle URLs from any `https://invertase.io/blog` URL.
|
||||
|
||||
`android/app/src/main/AndroidManifest.xml`:
|
||||
|
||||
```xml
|
||||
<manifest ...>
|
||||
<application android:name="com.your.app.MainApplication"
|
||||
...>
|
||||
<activity android:name="com.your.app.MainActivity"
|
||||
...>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="invertase.io"
|
||||
android:pathPrefix="/blog" />
|
||||
</intent-filter>
|
||||
```
|
||||
@@ -1,46 +0,0 @@
|
||||
---
|
||||
title: App Indexing
|
||||
description: Firebase App Indexing gets your app into Google Search.
|
||||
---
|
||||
|
||||
# App Indexing
|
||||
|
||||
Firebase App Indexing gets your app into Google Search. If users have your app installed, they can launch your app and
|
||||
go directly to the content they're searching for. App Indexing reengages your app users by helping them find both public
|
||||
and personal content right on their device, even offering query autocompletions to help them more quickly find what they
|
||||
need. If users don’t yet have your app, relevant queries trigger an install card for your app in Search results.
|
||||
|
||||
React Native Firebase provides functionality to handle events such as users opening the application via a URL which
|
||||
has been indexed by Firebase.
|
||||
|
||||
<Youtube id="C35OSHlTNwA" />
|
||||
|
||||
## Getting Started
|
||||
|
||||
<Grid>
|
||||
<Block
|
||||
icon="build"
|
||||
color="#ffc107"
|
||||
title="Quick Start"
|
||||
to="/quick-start"
|
||||
>
|
||||
Setup your application to handle indexed URLs.
|
||||
</Block>
|
||||
<Block
|
||||
icon="layers"
|
||||
color="#03A9F4"
|
||||
title="Reference"
|
||||
to="/reference"
|
||||
>
|
||||
Understand how to handle indexed URLs in your application in the reference documentation.
|
||||
</Block>
|
||||
</Grid>
|
||||
|
||||
## Learn more
|
||||
|
||||
Our documentation is a great place to start, however if you're looking for more help or want to help others,
|
||||
check out the resources below:
|
||||
|
||||
- [Stack Overflow](https://stackoverflow.com/questions/tagged/react-native-firebase-indexing)
|
||||
- [Github Issues](https://github.com/invertase/react-native-firebase/issues?utf8=%E2%9C%93&q=is%3Aissue+sort%3Aupdated-desc+label%3Aindexing+)
|
||||
- [Firebase Documentation](https://firebase.google.com/docs/firestore?utm_source=invertase&utm_medium=react-native-firebase&utm_campaign=indexing)
|
||||
@@ -1,44 +0,0 @@
|
||||
---
|
||||
title: iOS Setup | App Indexing
|
||||
description: Setup your iOS application to handle app indexed URLs.
|
||||
---
|
||||
|
||||
# iOS Manual Linking
|
||||
|
||||
To handle indexed URLs within your iOS app, the URL definition needs to be added to your project using XCode.
|
||||
|
||||
## Setup up with XCode
|
||||
|
||||
Depending on your setup, open the following file with XCode:
|
||||
|
||||
- Using Pods: `ios/<project>.xcworkspace`
|
||||
- None Pods Setup: `ios/<project>.xcodeproj`
|
||||
|
||||
### Navigate to URL Types
|
||||
|
||||
Open the URL Types configuration for your project:
|
||||
|
||||
1. Select your project on left hand side file tree
|
||||
2. Select the Info tab on the middle pane
|
||||
3. Expand the URL Types section header
|
||||
|
||||

|
||||
|
||||
### Create a URL Type and Scheme
|
||||
|
||||
After navigating to the URL Types section of your Xcode workspace you can now add a new URL type.
|
||||
|
||||
#### Add new URL type (+)
|
||||
|
||||
1. Click the Add items plus (+) icon at the bottom of the URL Types section:
|
||||
|
||||

|
||||
|
||||
#### Configure the new URL Type
|
||||
|
||||
1. Input the `Identifier` value; The Identifier is normally the same as your Bundle Identifier which is usually the reverse of the domain for your app e.g. com.mycompany.app.
|
||||
2. Input the `URL Schemes` value - this can be a comma delimited list of values; For example if you set this to myapp,foobar then your app will then accept urls from myapp://_ and foobar://_.
|
||||
|
||||
`Icon` and `Role` can be left to use the defaults unless you need to change these.
|
||||
|
||||

|
||||
@@ -1,107 +0,0 @@
|
||||
---
|
||||
title: App Indexing Quick Start
|
||||
description: Getting started with App Indexing in React Native Firebase
|
||||
---
|
||||
|
||||
# App Indexing Quick Start
|
||||
|
||||
## Installation
|
||||
|
||||
Install this module with Yarn:
|
||||
|
||||
```bash
|
||||
yarn add @react-native-firebase/indexing
|
||||
```
|
||||
|
||||
Setup your application by following the platform specific instructions:
|
||||
|
||||
<Grid>
|
||||
<Block
|
||||
icon="phone_android"
|
||||
color="#4CAF50"
|
||||
title="Android Setup"
|
||||
to="/android"
|
||||
>
|
||||
Setup your Android application to handle app indexed URLs.
|
||||
</Block>
|
||||
<Block
|
||||
icon="phone_iphone"
|
||||
color="#2196F3"
|
||||
title="iOS Setup"
|
||||
to="/ios"
|
||||
>
|
||||
Setup your iOS application to handle app indexed URLs.
|
||||
</Block>
|
||||
</Grid>
|
||||
|
||||
## Module usage
|
||||
|
||||
The app indexing module provides functionality to hook onto a user opening your application via an app indexed URL.
|
||||
|
||||
Import the module:
|
||||
|
||||
```js
|
||||
import indexing from '@react-native-firebase/indexing';
|
||||
```
|
||||
|
||||
The package also provides access to the firebase instance:
|
||||
|
||||
```js
|
||||
import { firebase } from '@react-native-firebase/indexing';
|
||||
```
|
||||
|
||||
### Detecting app opens from a URL
|
||||
|
||||
If a has your application installed, but in a closed state, opening an app indexed URL will cause the app to
|
||||
open. Once the app has loaded, the `getInitialURL()` method can be called to detected whether the app was opened
|
||||
by an app indexed URL. If your application was not opened via an app indexed URL, the value will be `null`.
|
||||
|
||||
Note: All URLs which trigger the app to open will be passed to this method, therefore it is important to check
|
||||
the domain of the URL to check it has come from an indexed source.
|
||||
|
||||
```js
|
||||
import indexing from '@react-native-firebase/indexing';
|
||||
|
||||
async function bootstrapApp() {
|
||||
const url = await indexing.getInitialURL();
|
||||
|
||||
if (url && url.startsWith('https://invertase.io')) {
|
||||
if (url === 'https://invertase.io/offers') {
|
||||
// Handle the URL, e.g. using a react-navigation custom service:
|
||||
NavigationService.navigate('OffersScreen', { from: 'indexing' });
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Subscribe to URL events
|
||||
|
||||
If a user has opened your app and it is open or in a background state, you must subscribe and handle the URL open
|
||||
event directly within your application life cycle using the `onOpenURL()` method.
|
||||
|
||||
Note: All URLs which trigger the app to handle it are passed to this method, therefore it is important to check
|
||||
the domain of the URL to check it has come from an indexed source.
|
||||
|
||||
```jsx
|
||||
import React, { useEffect } from 'react';
|
||||
import indexing from '@react-native-firebase/indexing';
|
||||
|
||||
function App({ navigation }) {
|
||||
// Listen to open URL events once ready
|
||||
useEffect(() => {
|
||||
const unsubscribe = indexing().onOpenURL(url => {
|
||||
if (url.startsWith('https://invertase.io')) {
|
||||
if (url === 'https://invertase.io/offers') {
|
||||
// Handle the URL, e.g. using the react-navigation navigation prop:
|
||||
navigation.navigate('OffersScreen', { from: 'indexing' });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Return the function to unsubscribe from
|
||||
return unsubscribe;
|
||||
}, []);
|
||||
|
||||
return <NavigationStack />;
|
||||
}
|
||||
```
|
||||
@@ -227,7 +227,7 @@
|
||||
to: '/ios'
|
||||
|
||||
- module: remote-config
|
||||
group: Remote RemoteConfig
|
||||
group: Remote Config
|
||||
children:
|
||||
- text: Overview
|
||||
to: '/'
|
||||
|
||||
Reference in New Issue
Block a user