public static void StartServer(ContextWrapper context, Intent intent) { if (Build.VERSION.SdkInt >= BuildVersionCodes.O) { context.StartForegroundService(intent); } else { context.StartService(intent); } }