Skip to content

Commit 99b4325

Browse files
authored
Merge pull request #25 from google-home/dev
Google Home API Sample App (1.7.1)
2 parents d3f3f6f + 9347647 commit 99b4325

10 files changed

Lines changed: 353 additions & 274 deletions

File tree

app/build.gradle.kts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
alias(libs.plugins.android.application)
55
alias(libs.plugins.kotlin.android)
66
alias(libs.plugins.kotlin.compose)
7-
id("com.google.devtools.ksp")
7+
alias(libs.plugins.ksp)
88
id("com.google.dagger.hilt.android")
99
alias(libs.plugins.errorprone)
1010
}
@@ -17,8 +17,8 @@ android {
1717
applicationId = "com.example.googlehomeapisampleapp"
1818
minSdk = 29
1919
targetSdk = 36
20-
versionCode = 38
21-
versionName = "1.7.0"
20+
versionCode = 39
21+
versionName = "1.7.1"
2222

2323
// Store your GCP project web client ID in local.properties and access it via project properties.
2424
// If local.properties doesn't exist in your app root folder, just create it
@@ -50,12 +50,12 @@ android {
5050
}
5151
}
5252
compileOptions {
53-
sourceCompatibility = JavaVersion.VERSION_1_8
54-
targetCompatibility = JavaVersion.VERSION_1_8
53+
sourceCompatibility = JavaVersion.VERSION_17
54+
targetCompatibility = JavaVersion.VERSION_17
5555
}
5656
kotlin {
5757
compilerOptions {
58-
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8)
58+
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
5959
}
6060
}
6161
buildFeatures {

app/src/main/AndroidManifest.xml

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,47 @@
44

55
<uses-sdk />
66

7+
<application
8+
android:name=".HomeApplication"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:roundIcon="@mipmap/ic_launcher_round"
12+
android:supportsRtl="true"
13+
android:theme="@style/Theme.GoogleHomeAPISampleApp"
14+
tools:targetApi="31">
15+
<meta-data
16+
android:name="androidx.lifecycle.ProcessLifecycleOwnerInitializer"
17+
android:value="androidx.startup" />
18+
19+
<activity
20+
android:name=".MainActivity"
21+
android:exported="true"
22+
android:theme="@style/Theme.GoogleHomeAPISampleApp"
23+
android:windowSoftInputMode="adjustResize">
24+
25+
<intent-filter>
26+
<action android:name="android.intent.action.MAIN" />
27+
<category android:name="android.intent.category.LAUNCHER" />
28+
</intent-filter>
29+
<intent-filter>
30+
<action android:name="com.google.android.gms.home.matter.ACTION_START_COMMISSIONING" />
31+
<category android:name="android.intent.category.DEFAULT" />
32+
</intent-filter>
33+
</activity>
34+
35+
<activity
36+
android:name=".AccountSwitchProxyActivity"
37+
android:exported="false"
38+
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
39+
<service
40+
android:name=".commissioning.ThirdPartyCommissioningService"
41+
android:exported="true"
42+
android:enabled="true">
43+
<intent-filter>
44+
<action android:name="com.google.android.gms.home.matter.commissioning.COMMISSION_DEVICE_TO_3P_FABRIC" />
45+
</intent-filter>
46+
</service>
47+
</application>
748
<uses-permission android:name="android.permission.INTERNET" />
849
<uses-permission android:name="com.google.android.gms.permission.BIND_COMMISSIONING_SERVICE" />
950
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
@@ -19,48 +60,6 @@
1960
<uses-permission android:name="android.permission.CAMERA" />
2061

2162
<uses-feature
22-
android:name="android.hardware.camera"
23-
android:required="false" />
24-
<application
25-
android:name=".HomeApplication"
26-
android:icon="@mipmap/ic_launcher"
27-
android:label="@string/app_name"
28-
android:roundIcon="@mipmap/ic_launcher_round"
29-
android:supportsRtl="true"
30-
android:theme="@style/Theme.GoogleHomeAPISampleApp"
31-
tools:targetApi="31">
32-
<meta-data
33-
android:name="androidx.lifecycle.ProcessLifecycleOwnerInitializer"
34-
android:value="androidx.startup" />
35-
36-
<activity
37-
android:name=".MainActivity"
38-
android:exported="true"
39-
android:theme="@style/Theme.GoogleHomeAPISampleApp"
40-
android:windowSoftInputMode="adjustResize">
41-
<intent-filter>
42-
<action android:name="android.intent.action.MAIN" />
43-
<category android:name="android.intent.category.LAUNCHER" />
44-
</intent-filter>
45-
<intent-filter>
46-
<action android:name="com.google.android.gms.home.matter.ACTION_START_COMMISSIONING" />
47-
<category android:name="android.intent.category.DEFAULT" />
48-
</intent-filter>
49-
</activity>
50-
<activity
51-
android:name=".AccountSwitchProxyActivity"
52-
android:exported="false"
53-
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
54-
55-
<service
56-
android:name=".commissioning.ThirdPartyCommissioningService"
57-
android:enabled="true"
58-
android:exported="true"
59-
android:permission="com.google.android.gms.permission.BIND_COMMISSIONING_SERVICE">
60-
<intent-filter>
61-
<action android:name="com.google.android.gms.home.matter.commissioning.COMMISSION_DEVICE_TO_3P_FABRIC" />
62-
</intent-filter>
63-
</service>
64-
</application>
65-
66-
</manifest>
63+
android:name="android.hardware.camera"
64+
android:required="false" />
65+
</manifest>

app/src/main/java/com/example/googlehomeapisampleapp/CommissioningManager.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ import com.google.android.gms.home.matter.commissioning.CommissioningWindow
3737
import com.google.android.gms.home.matter.commissioning.ShareDeviceRequest
3838
import com.google.android.gms.home.matter.common.DeviceDescriptor
3939
import com.google.android.gms.home.matter.common.Discriminator
40-
import kotlin.random.Random
4140
import kotlinx.coroutines.CoroutineScope
4241
import kotlinx.coroutines.delay
4342
import kotlinx.coroutines.flow.MutableStateFlow
4443
import kotlinx.coroutines.launch
4544
import kotlinx.coroutines.tasks.await
45+
import kotlin.random.Random
4646

4747
private const val TAG = "CommissioningManager"
4848

@@ -214,7 +214,7 @@ class CommissioningManager(
214214
}
215215

216216
FabricType.THIRD_PARTY_FABRIC -> {
217-
builder.setStoreToGoogleFabric(false)
217+
builder.setStoreToGoogleFabric(true)
218218
builder.setCommissioningService(
219219
ComponentName(context, ThirdPartyCommissioningService::class.java)
220220
)

0 commit comments

Comments
 (0)