<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.average.nfcauthcr"
- android:versionCode="1"
- android:versionName="1.0">
- <uses-sdk android:minSdkVersion="10"
- android:targetSdkVersion="17" />
+ package="org.average.nfcauthcr"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <uses-sdk android:minSdkVersion="10"
+ android:targetSdkVersion="17" />
- <uses-permission android:name="android.permission.NFC" />
- <uses-feature android:name="android.hardware.nfc"
- android:required="true" />
+ <uses-permission android:name="android.permission.NFC" />
+ <uses-feature android:name="android.hardware.nfc"
+ android:required="true" />
- <application android:label="@string/app_name"
- android:icon="@drawable/yalekey"
- android:allowBackup="true"
- android:theme="@style/AppTheme">
+ <application android:label="@string/app_name"
+ android:icon="@drawable/yalekey"
+ android:allowBackup="true"
+ android:theme="@style/AppTheme">
- <activity android:name=".Enroll"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name=".Check"
- android:label="@string/app_name">
- </activity>
+ <activity android:name=".Enroll"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
- </application>
+ <receiver android:name=".Autostart">
+ <intent-filter>
+ <action android:name="android.intent.action.USER_PRESENT" />
+ </intent-filter>
+ </receiver>
+ <receiver android:name=".Autostop">
+ <intent-filter>
+ <action android:name="android.intent.action.SCREEN_OFF" />
+ </intent-filter>
+ </receiver>
+
+ <service android:name=".Check"
+ android:label="@string/app_name">
+ </service>
+
+ </application>
</manifest>
--- /dev/null
+package org.average.nfcauthcr;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+import org.average.nfcauthcr.Check;
+
+public class Autostart extends BroadcastReceiver {
+
+ final String TAG = getClass().getName();
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.v(TAG, "Autostart called");
+ Intent i = new Intent(context, Check.class);
+ i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startService(i);
+ }
+}
--- /dev/null
+package org.average.nfcauthcr;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+import org.average.nfcauthcr.Check;
+
+public class Autostop extends BroadcastReceiver {
+
+ final String TAG = getClass().getName();
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.v(TAG, "Autostop called");
+ Intent i = new Intent(context, Check.class);
+ context.stopService(i);
+ }
+}