package Ġde . ad ors ys . android . sm spar ser Ċ Ċ import Ġandroid . Manifest Ċ import Ġandroid . app . Activity Ċ import Ġandroid . content . pm . PackageManager Ċ import Ġandroid . os . Build Ċ import Ġandroidx . annotation . Requires Api Ċ import Ġandroidx . core . content . Context Compat Ċ Ċ object ĠS ms Tool Ġ{ ĊĠĠĠ Ġconst Ġval ĠREQUEST _ CODE _ ASK _ PERMISSION S Ġ= Ġ 1 2 3 ĊĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġ@ Requires Api ( api Ġ= ĠBuild . VERSION _ CODES . M ) ĊĠĠĠ Ġfun Ġrequest SMS Permission ( activity : ĠActivity ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpermission Ġ= ĠManifest . permission . RECEIVE _ SMS ĊĠĠĠĠĠĠĠ Ġval Ġhas Specific Permission Ġ= ĠContext Compat . check Self Permission ( activity , Ġpermission ) ĊĠĠĠĠĠĠĠ Ġif Ġ( has Specific Permission Ġ!= ĠPackage Manager . PERMISSION _ GRAN TED Ġ&& Ġ! activity . should Show Request Permission R ationale ( permission )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġactivity . request Permissions ( array Of ( permission ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠREQUEST _ CODE _ ASK _ PERMISSION S ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }