1+ /*
2+ * Copyright 2024 The Android Open Source Project
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
117package com.example.snippets
218
319import android.content.BroadcastReceiver
@@ -106,7 +122,7 @@ class BroadcastReceiverViewModel @Inject constructor(
106122 }
107123
108124 fun sendBroadcast (newData : String , usePermission : Boolean = false) {
109- if (! usePermission) {
125+ if (! usePermission) {
110126 // [START android_broadcast_receiver_8_send]
111127 val intent = Intent (" com.example.snippets.ACTION_UPDATE_DATA" ).apply {
112128 putExtra(" com.example.snippets.DATA" , newData)
@@ -122,7 +138,6 @@ class BroadcastReceiverViewModel @Inject constructor(
122138 // [START android_broadcast_receiver_9_send_with_permission]
123139 context.sendBroadcast(intent, android.Manifest .permission.ACCESS_COARSE_LOCATION )
124140 // [END android_broadcast_receiver_9_send_with_permission]
125-
126141 }
127142 }
128143}
@@ -231,7 +246,7 @@ fun MyApp() {}
231246// [START android_broadcast_receiver_14_stateless]
232247@Composable
233248fun MyStatefulScreen () {
234- val myBroadcastReceiver = remember { MyBroadcastReceiver ()}
249+ val myBroadcastReceiver = remember { MyBroadcastReceiver () }
235250 val context = LocalContext .current
236251 LifecycleStartEffect (true ) {
237252 // [START_EXCLUDE]
0 commit comments