mhamade
11/03/2019, 3:24 AMcontext.getSystemService(VIBRATOR_SERVICE) as Vibrator
or context.getSystemService(VIBRATOR_SERVICE) as? Vibrator
tseisel
11/03/2019, 8:18 AMcontext.getSystemService<Vibrator>()
, available in androidx.core ?
Note that the first alternative will crash the app if the returned object is not a Vibrator or if it is null (which is very unlikely since the vibrator service exists since API 1)Luca Nicoletti
11/03/2019, 8:19 AMLuca Nicoletti
11/03/2019, 8:19 AMLuca Nicoletti
11/03/2019, 8:19 AMcontext.getSystemService(VIBRATOR_SERVICE) as? Vibrator
the second onemhamade
11/03/2019, 9:27 PMlouiscad
11/04/2019, 9:31 AMvibrator
using #splitties System Services artifact (available in top-level) in my humble and biased opinion.