Skip to content

Latest commit

 

History

History
172 lines (108 loc) · 7.11 KB

File metadata and controls

172 lines (108 loc) · 7.11 KB

This is a new React Native project, bootstrapped using @react-native-community/cli.

Installing on a tablet (no build required)

Prebuilt Android APKs are published under Releases. Download the latest homeboard-vX.Y.Z.apk and sideload it onto the tablet:

adb install homeboard-vX.Y.Z.apk

These release APKs ship with the project's Tibber OAuth credentials baked in, so the Tibber widgets work out of the box. You still authenticate with your own Tibber account on first use.

Building from source

Standard React Native setup applies — see Set Up Your Environment.

cd reactnative
npm install        # creates src/secrets.local.js from the example via postinstall
npm start          # Metro
npm run android    # in another terminal

Tibber OAuth credentials

Tibber doesn't offer a public/PKCE-only client mode for their Data API, so OAuth requires a client_id + client_secret baked into the app. The repo ships without real credentials; src/secrets.local.js is gitignored.

You have three options:

  1. Don't touch Tibber — the rest of the app builds and runs fine; only the Tibber widgets will refuse to start the OAuth flow.
  2. Register your own Tibber OAuth client at https://data-api.tibber.com/clients/manage (redirect URI homeboard://oauth/tibber for Android; add your web forwarder URI too if you run the Pi/kiosk build, see web/README.md), then put the values in reactnative/src/secrets.local.js. (thewall.tibber.com is only the token endpoint; there is no UI there.)
  3. Ask the repo admin if you'd rather not register your own app.

src/secrets.local.js is regenerated by the release workflow from GitHub Secrets, so the values you put in locally never reach the public repo.

Homeboard dev notes

Running on the Android emulator with LAN-sync support

The settings sync feature uses UDP multicast on 239.255.255.251:41234. The Android emulator runs behind QEMU's NAT, so multicast discovery doesn't reach the guest and replies to the host's port 41234 aren't forwarded back. Workaround:

# 1. Start the emulator (any AVD)
emulator -avd Medium_Tablet

# 2. Once it's booted, forward inbound UDP 41234 into the guest
adb -s emulator-5554 emu redir add udp:41234:41234

The redirect doesn't persist — re-run the second command after each emulator boot. macOS may prompt to allow incoming UDP on 41234 the first time; click Allow.

In the app's Settings → Share tab, the "Devices Nearby" section has a manual IP input row. Multicast discovery still won't reach the emulator, so type the receiver tablet's LAN IP there and tap Send to IP. Outbound unicast works through NAT, and the redirect catches the reply.

Wireless ADB to a physical tablet

# On the tablet: Settings → System → Developer options → Wireless debugging → on
# Tap "Pair device with pairing code" — note the pair port + 6-digit code

adb pair <tablet_ip>:<pair_port>          # one-time per Mac/tablet
adb connect <tablet_ip>:<connect_port>    # the other port shown on the Wireless debugging screen
adb devices                                # confirm tablet appears

Pairing only needs to happen once; on later sessions just adb connect <ip>:<port> after re-enabling wireless debugging.

Release install on the tablet

react-native run-android always tries to start Metro and prompts about port conflicts. For a release install, skip the wrapper and use gradle directly:

cd reactnative/android
ANDROID_SERIAL=<tablet_ip>:<port> ./gradlew installRelease

Release uses the debug keystore (good enough for personal sideload). The JS bundle is baked into the APK, so no Metro is needed at runtime.

Getting Started

Note: Make sure you have completed the Set Up Your Environment guide before proceeding.

Step 1: Start Metro

First, you will need to run Metro, the JavaScript build tool for React Native.

To start the Metro dev server, run the following command from the root of your React Native project:

# Using npm
npm start

# OR using Yarn
yarn start

Step 2: Build and run your app

With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:

Android

# Using npm
npm run android

# OR using Yarn
yarn android

iOS

For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).

The first time you create a new project, run the Ruby bundler to install CocoaPods itself:

bundle install

Then, and every time you update your native dependencies, run:

bundle exec pod install

For more information, please visit CocoaPods Getting Started guide.

# Using npm
npm run ios

# OR using Yarn
yarn ios

If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.

This is one way to run your app — you can also build it directly from Android Studio or Xcode.

Step 3: Modify your app

Now that you have successfully run the app, let's make changes!

Open App.tsx in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by Fast Refresh.

When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:

  • Android: Press the R key twice or select "Reload" from the Dev Menu, accessed via Ctrl + M (Windows/Linux) or Cmd ⌘ + M (macOS).
  • iOS: Press R in iOS Simulator.

Congratulations! 🎉

You've successfully run and modified your React Native App. 🥳

Now what?

  • If you want to add this new React Native code to an existing application, check out the Integration guide.
  • If you're curious to learn more about React Native, check out the docs.

Troubleshooting

If you're having issues getting the above steps to work, see the Troubleshooting page.

Learn More

To learn more about React Native, take a look at the following resources: