Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API_34 and above requires to use either RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED flags #151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ package com.example.platform.location.geofencing

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Context.RECEIVER_NOT_EXPORTED
import android.content.Intent
import android.content.IntentFilter
import android.os.Build
import android.util.Log
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
Expand Down Expand Up @@ -55,12 +57,16 @@ fun GeofenceBroadcastReceiver(
" Transition ${geofencingEvent.geofenceTransition}"
Log.d(
TAG,
alertString
alertString,
)
currentSystemOnEvent(alertString)
}
}
context.registerReceiver(broadcast, intentFilter)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
context.registerReceiver(broadcast, intentFilter, RECEIVER_NOT_EXPORTED)
} else {
context.registerReceiver(broadcast, intentFilter)
}
onDispose {
context.unregisterReceiver(broadcast)
}
Expand Down