TelephonyHelper

class TelephonyHelper(context: Context)(source)

Helper téléphonique centralisé.

Permissions requises selon l'usage :

  • READ_PHONE_STATE → état SIM, type réseau, isRoaming

  • CALL_PHONE → lancer un appel direct

Enregistrement Koin :

single { TelephonyHelper(androidContext()) }

Utilisation :

val info = telephonyHelper.getInfo()
println("Opérateur : ${info.operatorName} — ${info.networkType}")

// Ouvrir le composeur (pas de permission)
telephonyHelper.openDialer(context, "+33612345678")

// Appel direct (CALL_PHONE requis)
telephonyHelper.callDirect(context, "+33612345678")

Constructors

Link copied to clipboard
constructor(context: Context)

Functions

Link copied to clipboard
@RequiresPermission(value = "android.permission.CALL_PHONE")
fun callDirect(context: Context, phoneNumber: String)

Lance un appel direct — nécessite CALL_PHONE.

Link copied to clipboard
@RequiresPermission(value = "android.permission.READ_PHONE_STATE")
fun getInfo(): TelephonyInfo
Link copied to clipboard
@RequiresPermission(value = "android.permission.READ_PHONE_STATE")
fun getNetworkType(): NetworkType
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun openDialer(context: Context, phoneNumber: String)

Ouvre le composeur pré-rempli — aucune permission requise.