package Ġcom . thr ash attack . background _ tracker _ plugin Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . support . v 4 . app . Job Intent Service Ċ import Ġandroid . util . Log Ċ import Ġcom . thr ash attack . background _ tracker _ plugin . ge ofence . Ge of encing Store Ċ import Ġio . flutter . plugin . common . Method Channel Ċ import Ġio . flutter . plugin . common . Plugin Registry Ċ import Ġio . flutter . view . Flutter Callback Information Ċ import Ġio . flutter . view . Flutter Main Ċ import Ġio . flutter . view . Flutter Native View Ċ import Ġio . flutter . view . Flutter Run Arguments Ċ import Ġjava . util . concurrent . atomic . Atomic Boolean Ċ Ċ abstract Ġclass ĠHead less JobService ( val Ġbackground Channel Name : ĠString ) Ġ: ĠJob Intent Service (), ĠMethod Channel . MethodCall Handler Ġ{ ĊĠĠĠ Ġval ĠTAG Ġ= ĠHead less JobService :: class . java . canonical Name ĊĠĠĠ Ġlateinit Ġvar ĠmContext : ĠContext ĊĠĠĠ Ġlateinit Ġvar Ġm Background Channel : ĠMethod Channel ĊĠĠĠ Ġlateinit Ġvar Ġge of encing Store Ġ: ĠGe of encing Store ĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġs Service Started Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġvar Ġs Background Flutter View : ĠFlutter Native View ? Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġ@ Jvm Static ĊĠĠĠĠĠĠĠ Ġlateinit Ġvar Ġs Plugin Regist r ant Callback : ĠPlugin Registry . Plugin Regist r ant Callback ĊĊĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate () Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate () ĊĠĠĠĠĠĠĠ Ġstart Head less Service ( this ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprotected Ġfun Ġstart Head less Service ( context : ĠContext ){ ĊĠĠĠĠĠĠĠ Ġsynchronized ( s Service Started ){ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠmContext Ġ= Ġcontext ĊĠĠĠĠĠĠĠĠĠĠĠ Ġge of encing Store Ġ= ĠGe of encing Store ( mContext ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( s Background Flutter View Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġcallback Dispatcher Ġ= Ġge of encing Store . get Callback Dispatcher () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġcallback Info Ġ= ĠFlutter Callback Information . lookup Callback Information ( callback Dispatcher ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( callback Info Ġ== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠLog . e ( TAG , Ġ" Fatal : Ġfailed Ġto Ġfind Ġcallback ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠLog . i ( TAG , Ġ" Starting ĠGe of encing ĠService ...") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġs Background Flutter View Ġ= ĠFlutter Native View ( mContext , Ġtrue ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġregistry Ġ= Ġs Background Flutter View !!. plugin Registry ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġs Plugin Regist r ant Callback . register With ( registry ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġargs Ġ= ĠFlutter Run Arguments () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġargs . bundle Path Ġ= ĠFlutter Main . find App Bundle Path ( mContext ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġargs . entrypoint Ġ= Ġcallback Info . callback Name ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġargs . library Path Ġ= Ġcallback Info . callback Library Path ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġs Background Flutter View !!. run From Bundle ( args ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġm Background Channel Ġ= ĠMethod Channel ( s Background Flutter View , Ġbackground Channel Name ) ĊĠĠĠĠĠĠĠ Ġm Background Channel . set MethodCall Handler ( this ) ĊĠĠĠ Ġ} Ċ }