[go: nahoru, domu]

Skip to content

Commit

Permalink
Add tvOS documentation and revise quickstart instructions (#1318)
Browse files Browse the repository at this point in the history
Update user guides to reflect release of tvOS and generally update their flow.
  • Loading branch information
DellaBitta committed Jan 27, 2023
1 parent 689ec38 commit 9c8f9e3
Show file tree
Hide file tree
Showing 11 changed files with 1,174 additions and 866 deletions.
178 changes: 93 additions & 85 deletions analytics/testapp/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,104 +8,106 @@ with the

## Requirements

* [Unity](http://unity3d.com/) The quickstart project requires 2017.4 or higher.
* [Xcode](https://developer.apple.com/xcode/) 10.3 or higher
(when developing for iOS).
* [Unity](http://unity3d.com/) The quickstart project requires 2019 or higher.
* [Xcode](https://developer.apple.com/xcode/) 13.3.1 or higher
(when developing for iOS or tvOS).
* [Android SDK](https://developer.android.com/studio/index.html#downloads)
(when developing for Android).


## Building the Sample

### iOS
### iOS or tvOS

- Register your iOS app with Firebase.
- Register your iOS+ (iOS or tvOS) app with Firebase.
- Create a project in the
[Firebase console](https://firebase.google.com/console/),
and associate your iOS application.
[Firebase console](https://firebase.google.com/console/).
- Associate your project to an app by clicking the **Add app** button,
and selecting the **Unity** icon.
- Check the box labeled **Register as Apple app**.
- You should use `com.google.firebase.unity.analytics.testapp` as the
iOS bundle ID when creating the Firebase iOS app in the console.
**Apple bundle ID** when creating the Unity app in the console.
- If you do not use the prescribed Bundle ID, you will later need to
update the bundle identifier in Unity as described in
`Optional: Update the Project Bundle Identifier` below.
**Optional: Update the Project Bundle Identifier** below.
- Download the `GoogleService-Info.plist` file associated with your
Firebase project from the console.
This file identifies your iOS app to the Firebase backend, and will
This file identifies your iOS+ app to the Firebase backend, and will
need to be included in the sample later.
- For further details please refer to the
[general instructions](https://firebase.google.com/docs/ios/setup)
which describes how to configure a Firebase application for iOS.
page which describe how to configure a Firebase application for iOS
and tvOS.
- Download the
[Firebase Unity SDK](https://firebase.google.com/download/unity)
and unzip it somewhere convenient.
- Open the sample project in the Unity editor.
- Select the `File > Open Project` menu item.
- If Unity Hub appears, click `Add`. Otherwise click `Open`.
- Select the **File > Open Project** menu item.
- If Unity Hub appears, click **Add**. Otherwise click **Open**.
- Navigate to the sample directory `testapp` in the file dialog and click
`Open`.
**Open**.
- You might be prompted to upgrade the project to your version of Unity.
Click `Confirm` to upgrade the project and continue.
Click **Confirm** to upgrade the project and continue.
- Open the scene `MainScene`.
- Navigate to `Assets/Firebase/Sample/Analytics` in the `Project` window.
- Navigate to `Assets/Firebase/Sample/Analytics` in the **Project** window.
- Double click on the `MainScene` file to open it.
- Import the `Firebase Analytics` plugin.
- Import the Firebase Analytics plugin.
- Select the **Assets > Import Package > Custom Package** menu item.
- From the [Firebase Unity SDK](https://firebase.google.com/download/unity)
downloaded previously, import `FirebaseAnalytics.unitypackage` from the
directory that matches the version of Unity you use:
- Unity 5.x and earlier use the .NET 3.x framework, so you need to
import the `dotnet3/FirebaseAnalytics.unitypackage` package .
- Unity 2017.x and newer allow the use of the .NET 4.x framework. If
your project is configured to use .NET 4.x, import the
`dotnet4/FirebaseAnalytics.unitypackage` package.
downloaded previously, import `FirebaseAnalytics.unitypackage`.
- When the **Import Unity Package** window appears, click the **Import**
button.
- Add the `GoogleService-Info.plist` file to the project.
- Navigate to the `Assets/Firebase/Sample/Analytics` folder in the `Project`
window.
- Navigate to the `Assets/Firebase/Sample/Analytics` folder in the
**Project** window.
- Drag the `GoogleService-Info.plist` downloaded from the Firebase console
into the folder.
- NOTE: `GoogleService-Info.plist` can be placed anywhere under the
`Assets` folder.
- Optional: Update the Project Bundle Identifier
- Optional: Update the Project Bundle Identifier.
- If you did not use `com.google.firebase.unity.analytics.testapp`
as the iOS bundle ID when creating your app in the Firebase
as the **Apple bundle ID** when creating your app in the Firebase
Console, you will need to update the sample's Bundle Identifier.
- Select the `File > Build Settings` menu option.
- Select `iOS` in the `Platform` list.
- Click `Player Settings`
- In the `Settings for iOS` panel scroll down to `Bundle Identifier`
and update the value to the `iOS bundle ID` you provided when you
registered your app with Firebase.
- Build for iOS
- Select the `File > Build Settings` menu option.
- Select `iOS` in the `Platform` list.
- Click `Switch Platform` to select `iOS` as the target platform.
- Select the **File > Build Settings** menu option.
- Select **iOS** or **tvOS** in the **Platform** list, depending on your build
target.
- Click **Player Settings**.
- In the **Settings for iOS** or **Settings for tvOS** panel, scroll down
to **Bundle Identifier** and update the value to the
**Apple bundle ID** you provided when you registered your app with
Firebase.
- Build for iOS or tvOS.
- Select the **File > Build Settings** menu option.
- Select either **iOS** or **tvOS** in the **Platform** list.
- Click **Switch Platform** to enable your selection as the target platform.
- Wait for the spinner (compiling) icon to stop in the bottom right corner
of the Unity status bar.
- Click `Build and Run`.
- See the *Using the Sample* section below.
- Click **Build and Run**.
- See the **Using the Sample** section below.


### Android

- Register your Android app with Firebase.
- Create a project in the
[Firebase console](https://firebase.google.com/console/),
and attach your Android app to it.
- Create a Unity project in the
[Firebase console](https://firebase.google.com/console/).
- Associate your project to an app by clicking the **Add app** button,
and selecting the **Unity** icon.
- Check the box labeled **Register as Android app**.
- You should use `com.google.firebase.unity.analytics.testapp` as the
Android package name while you're testing.
**Android package name** while you're testing.
- If you do not use the prescribed package name, you will need to update
the bundle identifier as described in
`Optional: Update the Project Bundle Identifier` below.
**Optional: Update the Project Bundle Identifier** below.
- Android apps must be signed by a key, and the key's signature must
be registered to your project in the Firebase Console. To
[generate a SHA1](https://developers.google.com/android/guides/client-auth),
first you will need to set the keystore in the Unity project.
- Locate the `Publishing Settings` under `Player Settings`.
- Locate the **Publishing Settings** under **Player Settings** in the
Unity editor.
- Select an existing keystore, or create a new keystore using the
toggle.
- Select an existing key, or create a new key using "Create a new key".
- Select an existing key, or create a new key using
**Create a new key**.
- After setting the keystore and key, you can generate a SHA1 by
running this command:
```
Expand All @@ -116,68 +118,72 @@ with the
- From the main console view, click on your Android App at the top and
click the gear to open the settings page.
- Scroll down to your apps at the bottom of the page and click on
`Add Fingerprint`.
- Paste the SHA1 digest of your key into the form. The SHA1 box
will illuminate if the string is valid. If it's not valid, check
**Add Fingerprint**.
- Paste the SHA1 digest of your key into the form. The SHA1 box
will illuminate if the string is valid. If it's not valid, check
that you have copied the entire SHA1 digest string.
- Download the `google-services.json` file associated with your
Firebase project from the console.
This file identifies your Android app to the Firebase backend, and will
need to be included in the sample later.
- For further details please refer to the
[general instructions](https://firebase.google.com/docs/android/setup)
which describes how to configure a Firebase application for Android.
page which describes how to configure a Firebase application for
Android.
- Download the
[Firebase Unity SDK](https://firebase.google.com/download/unity)
and unzip it somewhere convenient.
- Open the sample project in the Unity editor.
- Select the `File > Open Project` menu item.
- If Unity Hub appears, click `Add`. Otherwise click `Open`.
- Select the **File > Open Project** menu item.
- If Unity Hub appears, click **Add**. Otherwise click **Open**.
- Navigate to the sample directory `testapp` in the file dialog and click
`Open`.
**Open**.
- You might be prompted to upgrade the project to your version of Unity.
Click `Confirm` to upgrade the project and continue.
Click **Confirm** to upgrade the project and continue.
- Open the scene `MainScene`.
- Navigate to `Assets/Firebase/Sample/Analytics` in the `Project` window.
- Navigate to `Assets/Firebase/Sample/Analytics` in the **Project** window.
- Double click on the `MainScene` file to open it.
- Import the `Firebase Analytics` plugin.
- Import the Firebase Analytics plugin.
- Select the **Assets > Import Package > Custom Package** menu item.
- From the [Firebase Unity SDK](https://firebase.google.com/download/unity)
downloaded previously, import `FirebaseAnalytics.unitypackage` from the
directory that matches the version of Unity you use:
- Unity 5.x and earlier use the .NET 3.x framework, so you need to
import the `dotnet3/FirebaseAnalytics.unitypackage` package .
- Unity 2017.x and newer allow the use of the .NET 4.x framework. If
your project is configured to use .NET 4.x, import the
`dotnet4/FirebaseAnalytics.unitypackage` package.
downloaded previously, import `FirebaseAnalytics.unitypackage`.
- When the **Import Unity Package** window appears, click the **Import**
button.
- Add the `google-services.json` file to the project.
- Navigate to the `Assets/Firebase/Sample/Analytics` folder in the `Project`
window.
- Navigate to the `Assets/Firebase/Sample/Analytics` folder in the
**Project** window.
- Drag the `google-services.json` downloaded from the Firebase console
into the folder.
- NOTE: `google-services.json` can be placed anywhere under the `Assets`
folder.
- Optional: Update the Project Bundle Identifier
- Optional: Update the Project Bundle Identifier.
- If you did not use `com.google.firebase.unity.analytics.testapp`
as the `Android package name` when you created your app in the Firebase
as the **Android package name** when you created your app in the Firebase
Console, you will need to update the sample's Bundle Identifier.
- Select the `File > Build Settings` menu option.
- Select `Android` in the `Platform` list.
- Click `Player Settings`
- In the `Settings for Android` panel scroll down to `Bundle Identifier`
and update the value to the package name you provided when you
registered your app with Firebase.
- Build for Android
- Select the `File > Build Settings` menu option.
- Select `Android` in the `Platform` list.
- Click `Switch Platform` to select `Android` as the target platform.
- Select the **File > Build Settings** menu option.
- Select **Android** in the **Platform** list.
- Click **Player Settings**.
- In the **Settings for Android** panel scroll down to
**Bundle Identifier** and update the value to the package name you
provided when you registered your app with Firebase.
- Build for Android.
- Select the **File > Build Settings** menu option.
- Select **Android** in the **Platform** list.
- Click **Switch Platform** to select **Android** as the target platform.
- Wait for the spinner (compiling) icon to stop in the bottom right corner
of the Unity status bar.
- Click `Build and Run`.
- See the *Using the Sample* section below.
- Click **Build and Run**.
- See the **Using the Sample** section below.

## Notes

### Usage on tvOS

This testapp was designed for use on iOS and Android targets, and when
running in the Unity editor. While the code will also execute on tvOS,
the buttons will be unresponsive as there isn't an easy way to provide
the app with the click / touch events to orchestrate the UI elements on
that platform.

## Using the Sample

Expand All @@ -195,8 +201,8 @@ various ways of logging Firebase Analytics events:
- `Log Level Up` button logs a level-up event, via a Firebase Analytics
event with multiple parameters, passed in as an array of parameters.

Press some of the buttons to log some events to your Firebase project.
After around 5 hours, data should be visible under the *Analytics* tab in
Press some of the buttons to log some events to your Firebase project. After
around 5 hours, data should be visible under the *Analytics* tab in
the [Firebase Console](https://firebase.google.com/console/)).


Expand All @@ -212,12 +218,14 @@ the [Firebase Console](https://firebase.google.com/console/)).
Settings**. Select your **Custom Keystore** from the dropdown list and
enter its password. Then, select your **Project Key** alias and enter
your key's password.
enabled in your project, you'll see compile errors from some types in the
- Please see the
[Known Issues](https://firebase.google.com/docs/unity/setup#known-issues)
section of the
Unity Setup Guide](https://firebase.google.com/docs/unity/setup) for other
[Unity Setup Guide](https://firebase.google.com/docs/unity/setup) for other
troubleshooting topics.
- When running the app, if all that you see is a blue horizon, then please
ensure that you followed the steps to **Open the scene `MainScene`**
above.


## Support
Expand Down
Loading

0 comments on commit 9c8f9e3

Please sign in to comment.