package Ġcom . s yle im an . ging erm oney . core . works Ċ Ċ import Ġandroidx . work .* Ċ import Ġcom . s yle im an . ging erm oney . Build Config Ċ import Ġcom . s yle im an . ging erm oney . core . works . update _ currency _ rate . Update Currency Rates Worker Ċ import Ġjava . util . concurrent . TimeUnit Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠWorks ManagerImpl Ċ @ Inject Ċ constructor () Ġ: ĠWorks Manager Ġ{ ĊĠĠĠ Ġprivate Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠWORK _ NAME Ġ= Ġ"${ Build Config . APPLICATION _ ID }. UPDATE _ CUR RE NCY _ RAT ES " ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġstart Currency Rates Updates () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġupdate Constraints Ġ= ĠConstraints . Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Required Network Type ( Network Type . CONNECTED ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġval Ġupdate Work Ġ= ĠPeriod ic Work RequestBuilder < Update Currency Rates Worker >( 6 , ĠTimeUnit . HOUR S ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Constraints ( update Constraints ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ ĠWork Manager . getInstance (). enqueue Unique Periodic Work ( WORK _ NAME , ĠExisting Periodic Work Policy . KEEP , Ġupdate Work ) ĊĠĠĠ Ġ} Ċ }