Skip to content

Conversation

@ansonYam
Copy link

@ansonYam ansonYam commented Jan 5, 2023

I was just stepping through the tutorial and saw that 'startActivityForResult' was deprecated, so I searched for the new way to launch an activity and pasted it here.

@riggaroo riggaroo requested a review from calren June 20, 2023 10:31
@calren
Copy link
Contributor

calren commented Jun 20, 2023

@marcelpinto Feel free to assign to the new owner for bluetoothle

@calren calren removed their request for review June 20, 2023 17:39
// [END enable_bluetooth]
}

private val getResult =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: getResult is not really the best name for this. Could you change it to requestResult or activityResult

if (bluetoothAdapter == null || !bluetoothAdapter.isEnabled) {
val enableBtIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT)
getResult.launch(enableBtIntent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add a comment:

// Launch the request with the ActivityResultContracts.StartActivityForResult

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants