Back to QuickRef

Android Development

Essential Android development links and quick references

android mobile development api

Overview

Essential Android development resources, APIs, and tools for quick reference during development.

Documentation

Phone Number Hinting API

// Phone Number Hint API example
private fun requestHint() {
    val hintRequest = HintRequest.Builder()
        .setPhoneNumberIdentifierSupported(true)
        .build()
    
    val intent = Credentials.getClient(this).getHintPickerIntent(hintRequest)
    startIntentSenderForResult(intent.intentSender, RESOLVE_HINT, null, 0, 0, 0)
}

Essential APIs & Services

Code Snippets

// Biometric Authentication
private fun showBiometricPrompt() {
    val biometricPrompt = BiometricPrompt(this, ContextCompat.getMainExecutor(this),
        object : BiometricPrompt.AuthenticationCallback() {
            override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
                super.onAuthenticationSucceeded(result)
                // Authentication succeeded
            }
        })
    
    val promptInfo = BiometricPrompt.PromptInfo.Builder()
        .setTitle("Biometric Authentication")
        .setSubtitle("Log in using your biometric credential")
        .setNegativeButtonText("Cancel")
        .build()
    
    biometricPrompt.authenticate(promptInfo)
}
// Permission Request (Modern approach)
private val requestPermissionLauncher = registerForActivityResult(
    ActivityResultContracts.RequestPermission()
) { isGranted: Boolean ->
    if (isGranted) {
        // Permission granted
    } else {
        // Permission denied
    }
}

// Usage
requestPermissionLauncher.launch(Manifest.permission.CAMERA)

Tools & Resources

Key Points

  • Use Jetpack Compose for modern UI development
  • Implement proper permission handling for API 23+
  • Follow Material Design guidelines
  • Use ViewBinding/DataBinding for view references
  • Implement proper lifecycle management

See Also

Categories:
links
Last updated: January 1, 2024