public static void CleanupApplication(Activity context) { context.stopService(new Intent(context, SpeechRecognition.class)); Util.RemoveDeviceNotificationEntry(context); try { BluetoothConnection bluetoothConnection = BluetoothConnection.CreateInstance(context); bluetoothConnection.cleanup(); } catch (Exception e) { Log.e("ContextMenu.java", "Unable to cleanup the Bluetooth connection", e); } try { EventScheduler eventScheduler = EventScheduler.CreateInstance(context, null); eventScheduler.cleanup(); } catch (Exception e) { Log.e("ContextMenu.java", "Unable to cleanup the EventScheduler", e); } }