File tree Expand file tree Collapse file tree 9 files changed +28
-28
lines changed
java/com/sample/android/bluetoothle
identity/credentialmanager/src/main
misc/src/androidTest/java/com/example/snippets Expand file tree Collapse file tree 9 files changed +28
-28
lines changed Original file line number Diff line number Diff line change 3737 with :
3838 distribution : ' zulu'
3939 java-version : ' 17'
40- - name : Build Compose
41- run : ./gradlew :compose:snippets:build
42- - name : Build recompose snippets
43- run : ./gradlew :compose:recomposehighlighter:build
44- - name : Build kotlin snippets
45- run : ./gradlew :kotlin:build
46- - name : Build Wear snippets
47- run : ./gradlew :wear:build
48- - name : Build misc snippets
49- run : ./gradlew :misc:build
50- - name : Build XR snippets
51- run : ./gradlew :xr:build
40+ - name : Build All
41+ run : ./gradlew build --stacktrace
5242 - name : Build Watch Face Push validation snippets
53- run : ./gradlew :watchfacepush:validator:run
43+ run : ./gradlew :watchfacepush:validator:run --stacktrace
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
2- <manifest xmlns : android =" http://schemas.android.com/apk/res/android"
3- package =" com.sample.android.bluetoothle" >
2+ <manifest xmlns : android =" http://schemas.android.com/apk/res/android" >
43
54 <uses-permission android : name =" android.permission.BLUETOOTH_CONNECT" />
65 <uses-permission android : name =" android.permission.BLUETOOTH_SCAN" />
2322 <uses-permission android : name =" android.permission.BLUETOOTH" />
2423 <uses-permission android : name =" android.permission.BLUETOOTH_ADMIN" />
2524
25+ <uses-permission android : name =" android.permission.ACCESS_COARSE_LOCATION" />
2626 <uses-permission android : name =" android.permission.ACCESS_FINE_LOCATION" />
27-
2827</manifest >
Original file line number Diff line number Diff line change 11package com .sample .android .bluetoothle .java ;
22
3- import androidx .appcompat .app .AppCompatActivity ;
4-
3+ import android .Manifest ;
54import android .bluetooth .BluetoothAdapter ;
65import android .bluetooth .BluetoothManager ;
76import android .content .Context ;
87import android .content .Intent ;
98import android .os .Bundle ;
109
10+ import androidx .annotation .RequiresPermission ;
11+ import androidx .appcompat .app .AppCompatActivity ;
12+
1113import com .sample .android .bluetoothle .R ;
1214
1315public class MainActivity extends AppCompatActivity {
@@ -19,6 +21,7 @@ protected void onCreate(Bundle savedInstanceState) {
1921 setContentView (R .layout .activity_main );
2022 }
2123
24+ @ RequiresPermission (Manifest .permission .BLUETOOTH_CONNECT )
2225 private void setUpBLE () {
2326 // [START get_bluetooth_adapter]
2427 // Initializes Bluetooth adapter.
Original file line number Diff line number Diff line change 1616
1717package com.sample.android.bluetoothle.kotlin
1818
19+ import android.Manifest
1920import android.app.ListActivity
2021import android.bluetooth.BluetoothAdapter
2122import android.bluetooth.le.ScanCallback
2223import android.bluetooth.le.ScanResult
2324import android.os.Handler
25+ import androidx.annotation.RequiresPermission
2426import com.sample.android.bluetoothle.java.LeDeviceListAdapter
2527
2628/* *
@@ -47,6 +49,7 @@ class DeviceScanActivity : ListActivity() {
4749 // Stops scanning after 10 seconds.
4850 private val SCAN_PERIOD : Long = 10000
4951
52+ @RequiresPermission(Manifest .permission.BLUETOOTH_SCAN )
5053 private fun scanLeDevice () {
5154 if (! mScanning) { // Stops scanning after a pre-defined scan period.
5255 handler.postDelayed({
Original file line number Diff line number Diff line change 1616
1717package com.sample.android.bluetoothle.kotlin
1818
19+ import android.Manifest
1920import android.bluetooth.BluetoothAdapter
2021import android.bluetooth.BluetoothManager
2122import android.content.Context
2223import android.content.Intent
2324import android.os.Bundle
25+ import androidx.annotation.RequiresPermission
2426import androidx.appcompat.app.AppCompatActivity
2527
2628class MainActivity : AppCompatActivity () {
@@ -31,6 +33,7 @@ class MainActivity : AppCompatActivity() {
3133 super .onCreate(savedInstanceState)
3234 }
3335
36+ @RequiresPermission(Manifest .permission.BLUETOOTH_CONNECT )
3437 private fun setUpBLE () {
3538 // [START get_bluetooth_adapter]
3639 // Initializes Bluetooth adapter.
Original file line number Diff line number Diff line change 4545 android : enabled =" true"
4646 android : exported =" true"
4747 android : label =" My Credential Provider"
48- android : icon =" <any drawable icon> "
48+ android : icon =" @mipmap/ic_launcher "
4949 android : permission =" android.permission.BIND_CREDENTIAL_PROVIDER_SERVICE"
5050 tools : targetApi =" upside_down_cake" >
5151 <intent-filter >
Original file line number Diff line number Diff line change 1616
1717package com .example .snippets ;
1818
19+ import androidx .appcompat .app .AppCompatActivity ;
1920import androidx .test .core .app .ActivityScenario ;
2021import androidx .test .ext .junit .rules .ActivityScenarioRule ;
2122import org .junit .Rule ;
@@ -33,16 +34,18 @@ public void activity_launched_notLetterBoxed() {
3334 try (ActivityScenario <MainActivity > scenario =
3435 ActivityScenario .launch (MainActivity .class )) {
3536 scenario .onActivity ( activity -> {
36- assertFalse (isLetterboxed (activity ));
37+ assertFalse (activity . isLetterboxed ());
3738 });
3839 }
3940 }
4041 // [END android_device_compatibility_mode_assert_isLetterboxed_java]
4142
4243
43- // Method used by snippets.
44- public boolean isLetterboxed (MainActivity activity ) {
45- return true ;
46- }
44+ // Class used by snippets.
4745
46+ class MainActivity extends AppCompatActivity {
47+ public boolean isLetterboxed () {
48+ return true ;
49+ }
50+ }
4851}
Original file line number Diff line number Diff line change @@ -36,10 +36,9 @@ class DeviceCompatibilityModeTestKotlinSnippets {
3636 }
3737 // [END android_device_compatibility_mode_assert_isLetterboxed_kotlin]
3838
39- // Classes used by snippets.
39+ // Class used by snippets.
4040
4141 class MainActivity : AppCompatActivity () {
42-
4342 fun isLetterboxed (): Boolean {
4443 return true
4544 }
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ android {
1919 sourceCompatibility = JavaVersion .VERSION_11
2020 targetCompatibility = JavaVersion .VERSION_11
2121 }
22- kotlinOptions {
23- jvmTarget = " 11 "
22+ kotlin {
23+ jvmToolchain( 11 )
2424 }
2525 buildFeatures {
2626 compose = true
You can’t perform that action at this time.
0 commit comments