package Ġme . cyber . n uk le os . sensors Ċ Ċ import Ġandroid . preference . Preference Manager Ċ import Ġme . cyber . n uk le os . App Ċ Ċ object ĠLast Known Sensor Manager Ġ{ ĊĊĠĠĠ Ġprivate Ġconst Ġval ĠS ENSOR _ NAME _ KEY Ġ= Ġ" last _ known _ sensor " ĊĊĠĠĠ Ġfun Ġupdate Last Known Sensor ( sensor : ĠSensor ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġshared Preferences Ġ= ĠPreference Manager . getDefault SharedPreferences ( App . application Component . get AppContext ()) ĊĠĠĠĠĠĠĠ Ġshared Preferences . edit (). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġput String ( SENSOR _ NAME _ KEY , Ġsensor . name ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġapply () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠgetLast Known Sensor Name (): ĠString ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠPreference Manager . getDefault SharedPreferences ( App . application Component . get AppContext ()). getString ( SENSOR _ NAME _ KEY , Ġnull ) ĊĠĠĠ Ġ} Ċ }