package Ġcom . sensor berg . notifications . sdk . internal . backend . backends dk v 2 . intercept ors Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . pm . PackageManager Ċ import Ġandroid . os . Build Ċ import Ġcom . sensor berg . notifications . sdk . Build Config Ċ import Ġcom . sensor berg . notifications . sdk . internal . backend . backends dk v 2 . Transport Ċ import Ġokhttp 3 . Request Ċ import Ġtim ber . log . Tim ber Ċ import Ġjava . net . URL Encoder Ċ Ċ internal Ġclass ĠUser Agent ( context : ĠContext ) Ġ: ĠAdd Header Ġ{ ĊĊ ĉ private Ġval Ġuser Agent : ĠString ĊĊ ĉ override Ġfun Ġon Header ( builder : ĠRequest . Builder ) Ġ{ Ċĉ ĉ builder . header ( Transport . HEADER _ USER _ AGENT , Ġuser Agent ) Ċ ĉ } ĊĊ ĉ init Ġ{ Ċĉ ĉ val ĠpackageName Ġ= Ġcontext . packageName Ċĉ ĉ val Ġpm Ġ= Ġcontext . package Manager Ċĉ ĉ val Ġai Ġ= Ġcontext . application Info Ċĉ ĉ val Ġapp Label Ġ= ĠURL Encoder . encode ( pm . getApplication Label ( ai ). toString ()) Ċĉ ĉ val Ġapp Version Ġ= Ġget App Version String ( context ) ĊĊĉ ĉ userAgent Ġ= Ġ"$ app Label /$ packageName /$ app Version Ġ" Ġ+ Ċĉĉĉ ĉ "( Android Ġ${ Build . VERSION . RELEASE } Ġ${ Build . CPU _ ABI }) Ġ" Ġ+ Ċĉĉĉ ĉ " (${ Build . MAN U FACT UR ER }:${ Build . MODEL }:${ Build . PRODUCT }) Ġ" Ġ+ Ċĉĉĉ ĉ " Sensor berg ĠNotifications ĠSDK Ġ${ Build Config . VERSION _ NAME }" ĊĊĉ ĉ Tim ber . i (" Backend Ġheader ĠUser - Agent : Ġ$ userAgent ") Ċ ĉ } ĊĊ ĉ private Ġfun Ġget App Version String ( context : ĠContext ): ĠString Ġ{ Ċĉ ĉ return Ġtry Ġ{ Ċĉĉ ĉ val Ġmy Info Ġ= Ġcontext . package Manager . get Package Info ( context . packageName , Ġ 0 ) Ċĉĉ ĉ URL Encoder . encode ( my Info . version Name ) Ġ+ Ġ"/" Ġ+ Ġmy Info . version Code Ċĉ ĉ } Ġcatch Ġ( e : ĠPackage Manager . Name NotFoundException ) Ġ{ Ċĉĉ ĉ "< unknown >" Ċĉ ĉ } Ġcatch Ġ( e : ĠNullPointerException ) Ġ{ Ċĉĉ ĉ "< unknown >" Ċĉ ĉ } Ċ ĉ } Ċ Ċ }