Android Open Source - nightvision Night Vision Activity






From Project

Back to project page nightvision.

License

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.

Java Source Code

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();
        }
    };
}




Java Source Code List

com.ford.openxc.nightvision.BootupReceiver.java
com.ford.openxc.nightvision.NightVisionActivity.java
com.ford.openxc.nightvision.NightVisionView.java
com.ford.openxc.nightvision.VehicleMonitoringService.java