Back to project page nightvision.
The source code is released under:
Copyright (c) 2012 Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are me...
If you think the Android project nightvision listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.ford.openxc.nightvision; // w ww . j a v a2 s . co m import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.util.Log; public class NightVisionActivity extends Activity { private static final String TAG = "NightVisionActivity"; private static boolean mRunning; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent MonitoringServiceIntent = new Intent(NightVisionActivity.this, VehicleMonitoringService.class); startService(MonitoringServiceIntent); Log.w(TAG, "Starting Service from NightVisionActivity"); } @Override public void onPause() { super.onPause(); mRunning = false; } @Override public void onResume() { super.onResume(); mRunning = true; IntentFilter filter = new IntentFilter(); filter.addAction(VehicleMonitoringService.ACTION_VEHICLE_HEADLAMPS_OFF); registerReceiver(closeReceiver, filter); } @Override public void onDestroy() { super.onDestroy(); unregisterReceiver(closeReceiver); } public static boolean isRunning() { return mRunning; } BroadcastReceiver closeReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { finish(); } }; }