Added autostart on boot feature
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="uk.org.openseizuredetector"
|
||||
android:versionCode="30"
|
||||
android:versionName="2.0.9">
|
||||
android:versionCode="31"
|
||||
android:versionName="2.3.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="14" />
|
||||
|
||||
@@ -18,8 +18,10 @@
|
||||
android:name="android.hardware.telephony"
|
||||
android:required="false" />
|
||||
|
||||
<android:uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
|
||||
<application
|
||||
android:icon="@drawable/star_of_life_48x48"
|
||||
@@ -45,6 +47,18 @@
|
||||
android:exported="false" />
|
||||
|
||||
<activity android:name=".LogManagerActivity"></activity>
|
||||
|
||||
<receiver
|
||||
android:name=".BootBroadcastReceiver"
|
||||
android:label="BootBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
|
||||
</application>
|
||||
|
||||
|
||||
|
||||
</manifest> <!-- android:uiOptions="splitActionBarWhenNarrow" -->
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package uk.org.openseizuredetector;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* Created by graham on 14/12/16.
|
||||
*/
|
||||
|
||||
public class BootBroadcastReceiver extends BroadcastReceiver {
|
||||
private String TAG = "BroadcastReceiver";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Log.v(TAG, "onReceive()");
|
||||
SharedPreferences SP = PreferenceManager
|
||||
.getDefaultSharedPreferences(context);
|
||||
boolean autoStart = SP.getBoolean("AutoStart",false);
|
||||
Log.v(TAG,"onReceive() - autoStart = "+autoStart);
|
||||
if (autoStart && Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
|
||||
Intent startUpIntent = new Intent(context, StartupActivity.class);
|
||||
startUpIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(startUpIntent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,13 @@
|
||||
android:key="UpdatePeriod"
|
||||
android:summary="Display update period in miliseconds."
|
||||
android:title="Display Update Period (ms)." />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="AutoStart"
|
||||
android:summary="Auto Start App on Boot"
|
||||
android:title="Auto Start App on Boot"
|
||||
android:enabled="true"
|
||||
/>
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="UseIpCamera"
|
||||
|
||||
Reference in New Issue
Block a user