package Ġcom . sensor berg . notifications . sdk . internal Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroid . content . Intent Ċ import Ġandroid . content . SharedPreferences Ċ import Ġcom . sensor berg . notifications . sdk . Action Ċ import Ġcom . sensor berg . notifications . sdk . Conversion Ċ import Ġcom . sensor berg . notifications . sdk . Notifications Sdk Ċ import Ġcom . sensor berg . notifications . sdk . internal . model . Action History Ċ import Ġcom . sensor berg . notifications . sdk . internal . model . Trigger Ċ import Ġcom . sensor berg . notifications . sdk . internal . model . to Action History Ċ import Ġcom . sensor berg . notifications . sdk . internal . storage . Action Dao Ċ import Ġtim ber . log . Tim ber Ċ Ċ internal Ġclass ĠAction Launcher ( private Ġval Ġapp : ĠApplication , ĊĉĉĉĉĉĉĉĠ Ġprivate Ġval Ġdao : ĠAction Dao , ĊĉĉĉĉĉĉĉĠ Ġprivate Ġval Ġprefs : ĠSharedPreferences ) Ġ{ ĊĊ ĉ private Ġval Ġpermission Name : ĠString Ġ= Ġapp . packageName Ġ+ ĠSDK _ PERMISSION ĊĊ ĉ fun Ġlaunch Action ( action : ĠAction , Ġtype : ĠTrigger . Type ) Ġ{ ĊĊĉ ĉ val Ġhistory : ĠAction History Ġ= Ġaction . to Action History ( type , Ġapp . getLast Location ()) Ċĉ ĉ dao . insert Action History ( history ) ĊĊĉ ĉ Tim ber . d (" action Ġreceived Ġto Ġlaunch Ġwith ĠAction Launcher : Ġ$ action ") ĊĊĉ ĉ val Ġquery Result Ġ= Ġapp . package Manager . query Broadcast Re ceiv ers ( new Intent ( app ), Ġ 0 ) Ċĉ ĉ if Ġ( query Result Ġ!= Ġnull Ġ&& Ġquery Result . isNotEmpty ()) Ġ{ ĊĊĉĉ ĉ val Ġintent Ġ= Ġnew Intent ( app , Ġquery Result [ 0 ]. activity Info . name ) Ċĉĉ ĉ action . writeTo Intent ( intent ) Ċĉĉ ĉ app . send Broadcast ( intent , Ġpermission Name ) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ comp anion Ġobject Ġ{ Ċĉ ĉ private Ġconst Ġval ĠSDK _ PERMISSION Ġ= Ġ". permission . notification . sdk " ĊĊĉ ĉ private Ġfun Ġnew Intent ( app : ĠApplication , ĠclassName : ĠString ? Ġ= Ġnull ): ĠIntent Ġ{ Ċĉĉ ĉ return ĠIntent (). apply Ġ{ Ċĉĉĉ ĉ action Ġ= ĠNotifications Sdk . ACTION _ RECE IVER Ċĉĉĉ ĉ ` package ` Ġ= Ġapp . packageName Ċĉĉĉ ĉ className ?. let Ġ{ Ġset ClassName ( app , Ġit ) Ġ} Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } Ċ } Ċ