# :iphone: Home Assistant Companion for Android ![Beta Deploy](https://github.com/home-assistant/android/workflows/Beta%20Deploy/badge.svg)
## Documentation
If you are looking for documentation around the companion applications check out the [Home Assistant Companion Documentation](https://companion.home-assistant.io/). This will provide you instructions on using the applications.
## Setup App Development Environment
1. Download and install [Android Studio](https://developer.android.com/studio)
2. Download / clone this repository to a folder on your computer
3. Create a Firebase project at [Firebase Console](https://console.firebase.google.com)
4. Create four Android apps, with following package names
- `io.homeassistant.companion.android`
- `io.homeassistant.companion.android.debug`
- `io.homeassistant.companion.android.minimal`
- `io.homeassistant.companion.android.minimal.debug`
5. Now download the `google-services.json` file and put it in the project's _/app_, _/automotive_ and _/wear_ folders. This file contains the configuration of the whole project (all four applications). ([You can also use the mock services file instead of generating your own](/.github/mock-google-services.json). The file should contain client IDs for all packages listed above for debugging to work properly. **If you do not generate your own file FCM push notification will never work, only websocket notifications will**)
6. Start Android Studio, open your source code folder and check if the Gradle build will be successful using Build/Make Module "App". You might have to install the right Android SDK via Tools/SDK Manager first.
7. Run `gradlew assembleDebug` to build all debug versions, this might take a while.
8. If the build is successful, you can run the app by doing the following: click **Run** -> **Run 'app'**.
9. Connect your phone or create a new virtual device following on screen instruction
10. :tada:
If you get stuck while setting up your own environment, you can ask questions in the **#devs_mobile_apps** channel on [Discord](https://discord.gg/c5DvZ4e).
### Push Notifications
If you want to work on push notifications or use a development build with push notifications, please go the server side code [HERE](https://github.com/home-assistant/mobile-apps-fcm-push) and deploy it to your firebase project. Once you have your androidV1 URL to the deployed service, set it in to your `${GRADLE_USER_HOME}/gradle.properties` file, e.g.:
```properties
homeAssistantAndroidPushUrl=https://mydomain.cloudfunctions.net/androidV1
```
You can also define the rate limit function URL, e.g.:
```properties
homeAssistantAndroidRateLimitUrl=https://mydomain.cloudfunctions.net/checkRateLimits
```
## App Flavors
The Android app has both a full flavor that uses Google Play Services to offer features like location tracking and notifications. There is also a minimal flavor that does not require Google Play Services and can be found in the releases section. The minimal flavor does not have location tracking or notifications.
## Building for publishing
To build the app for publishing, you will need to sign the app. To do this, do the following:
1. Create keystore containing keypair for debug application signing. In Android Studio: Menu/Build/Generate signed APK, then use a button to create new keystore. Remember the passwords and key alias. Default, the keystore must be named `release_keystore.keystore` and should be placed in the _home-assistant-Android/app_ and _home-assistant-Android/wear_ folder.
2. Set environmental variables used in `app/build.gradle.kts`:
- `KEYSTORE_PASSWORD`
- `KEYSTORE_ALIAS`
- `KEYSTORE_ALIAS_PASSWORD`
- `KEYSTORE_PATH` (if your keystore is located differently than stated above)
3. Run `gradlew build`
4. The signed APK is located in your build folder
## Testing Dev Releases
We are using [Github Actions](https://github.com/home-assistant/android/actions) to perform continuous integration both by unit testing, deploying dev releases to [Play Store Beta](https://play.google.com/apps/testing/io.homeassistant.companion.android) and final releases to the [Play Store](https://play.google.com/store/apps/details?id=io.homeassistant.companion.android) when we release. To help test out a specific feature/fixes users can find the APK on the Actions page for each pull request, this debug APK can be installed side-by-side the production or beta builds.
## Quality
We are using [ktlint](https://ktlint.github.io/) as our linter.
You can run a check locally on your machine with:
```bash
./gradlew ktlintCheck
```
This commands runs on our CI to check if your PR passes all tests. So we strongly recommend running it before committing.
To run a check with an auto-format:
```bash
./gradlew ktlintFormat
```
## Translating
The project currently uses [lokalise](https://lokalise.com/public/145814835dd655bc5ab0d0.36753359/) to translate the application. If you are interested in helping translate go to the link and click start translating!
## Generating a release to production
* Go to the latest Pre-Release and edit it
* Delete the body of the release, select the last full release tag and auto generate the release notes
* Uncheck the Pre-Release box and click update release
* This should cause the `Play Publish Production` Workflow to execute and should handle the rest
没有合适的资源?快使用搜索试试~ 我知道了~
Home Assistant Companion for Android
共900个文件
kt:570个
xml:208个
png:52个
需积分: 5 0 下载量 28 浏览量
2024-03-03
23:13:54
上传
评论
收藏 18.7MB ZIP 举报
温馨提示
适用于 Android 的 Home Assistant 的全面的文档和样例,包括sample code , 安装指南等。
资源推荐
资源详情
资源评论
收起资源包目录
Home Assistant Companion for Android (900个子文件)
Appfile 116B
gradlew.bat 3KB
.editorconfig 354B
Fastfile 3KB
Gemfile 90B
.gitignore 497B
gradlew 8KB
gradle-wrapper.jar 58KB
widget_example_camera.jpg 36KB
mdi_id_map.json 85KB
45.json 33KB
44.json 31KB
43.json 30KB
42.json 30KB
40.json 29KB
41.json 29KB
39.json 29KB
38.json 29KB
37.json 23KB
36.json 22KB
35.json 22KB
34.json 22KB
33.json 21KB
32.json 21KB
31.json 21KB
30.json 21KB
29.json 20KB
28.json 20KB
27.json 20KB
26.json 19KB
25.json 17KB
24.json 17KB
mock-google-services.json 1KB
MessagingManager.kt 83KB
WebViewActivity.kt 71KB
LocationSensorManager.kt 61KB
AppDatabase.kt 51KB
Entity.kt 38KB
WebSocketRepositoryImpl.kt 37KB
IntegrationRepositoryImpl.kt 35KB
MediaPlayerControlsWidget.kt 33KB
SensorDetailView.kt 28KB
SettingsFragment.kt 24KB
SensorDetailViewModel.kt 23KB
NetworkSensorManager.kt 23KB
HaControlsProviderService.kt 23KB
WearToggleChip.kt 22KB
ButtonWidgetConfigureActivity.kt 22KB
SensorReceiverBase.kt 21KB
MainViewModel.kt 21KB
HomeView.kt 20KB
BluetoothSensorManager.kt 19KB
CarSensorManager.kt 19KB
ButtonWidget.kt 18KB
MainView.kt 18KB
WebViewPresenterImpl.kt 18KB
EntityWidgetConfigureActivity.kt 17KB
HealthServicesSensorManager.kt 17KB
SettingsWearViewModel.kt 17KB
AssistSheetView.kt 16KB
DetailsPanelView.kt 16KB
ServerSettingsFragment.kt 16KB
ThreadManagerImpl.kt 16KB
AudioSensorManager.kt 16KB
LocationTrackingView.kt 15KB
ManageControlsView.kt 14KB
NotificationSensorManager.kt 14KB
ManageTilesViewModel.kt 14KB
EntityWidget.kt 14KB
TileExtensions.kt 13KB
AssistViewModel.kt 13KB
ShortcutsTile.kt 13KB
ManageShortcutsView.kt 13KB
ConversationView.kt 13KB
PhoneSettingsListener.kt 12KB
WebsocketManager.kt 12KB
AuthenticationFragment.kt 12KB
MediaPlayerControlsWidgetConfigureActivity.kt 12KB
TemplateWidget.kt 12KB
BatterySensorManager.kt 12KB
SettingsPresenterImpl.kt 12KB
ActivitySensorManager.kt 12KB
SsidView.kt 12KB
ConversationViewModel.kt 12KB
SensorManager.kt 12KB
AppSensorManagerBase.kt 12KB
CameraTile.kt 11KB
HomePresenterImpl.kt 11KB
TemplateWidgetConfigureActivity.kt 11KB
TemplateTile.kt 11KB
LaunchActivity.kt 10KB
NotificationFunctions.kt 10KB
SettingsView.kt 10KB
LogFragment.kt 10KB
MatterCommissioningView.kt 10KB
CameraWidget.kt 10KB
PrefsRepositoryImpl.kt 10KB
WearPrefsRepositoryImpl.kt 10KB
SettingsWearActivity.kt 10KB
EntityGridVehicleScreen.kt 10KB
共 900 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
AI普惠行者
- 粉丝: 1679
- 资源: 125
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功