Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

Commit

Permalink
auto start daemon option
Browse files Browse the repository at this point in the history
  • Loading branch information
raffaeleragni committed May 10, 2013
1 parent 751b087 commit ba6d5a9
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apkmodule/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ki.wardrive4"
android:versionCode="7"
android:versionName="1.6">
android:versionCode="8"
android:versionName="1.7">

<uses-sdk android:minSdkVersion="15"/>

Expand Down
2 changes: 1 addition & 1 deletion apkmodule/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>ki.wardrive4</groupId>
<artifactId>wardrive4-apk</artifactId>
<version>7-SNAPSHOT</version>
<version>8</version>
<packaging>apk</packaging>
<name>wardrive4-apk</name>

Expand Down
4 changes: 3 additions & 1 deletion apkmodule/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<string name="mapviewer_menu_import">Import</string>
<string name="mapviewer_menu_export">Export</string>
<string name="mapviewer_menu_start_scanning">Start scanning</string>
<string name="mapviewer_menu_scanning">Scanning...</string>
<string name="mapviewer_menu_scanning">[Stop] Scanning...</string>
<string name="mapviewer_menu_settings">Settings</string>

<string name="dlg_import_title">Choose import source</string>
Expand Down Expand Up @@ -41,6 +41,8 @@
<string name="settings_gpserror_summary">Acceptable error of GPS calculation in meters. When error is bigger, WiFi are not scanned. Default is 50.</string>
<string name="setting_minlevel_title">WiFi strength</string>
<string name="setting_minlevel_summary">The minimum WiFi strength accepted for scanning. Value is expressed in dBm. Default is -99.</string>
<string name="settings_autostartscan_title">Scanning Auto Start</string>
<string name="settings_autostartscan_summary">Activates the WiFi scanning on application start</string>

<string name="settings_header_map">Map options</string>
<string name="settings_mapfollowme_title">Follow my position</string>
Expand Down
5 changes: 5 additions & 0 deletions apkmodule/res/xml/settings_gps.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@
android:key="minlevel"
android:defaultValue="@string/settings_minlevel_defaultvalue"
/>
<CheckBoxPreference
android:title="@string/settings_autostartscan_title"
android:summary="@string/settings_autostartscan_summary"
android:key="autostartscan"
/>
</PreferenceScreen>
26 changes: 25 additions & 1 deletion apkmodule/src/ki/wardrive4/activity/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import ki.wardrive4.C;
import ki.wardrive4.data.WiFiSecurity;
import ki.wardrive4.provider.wifi.WiFiContract;
import ki.wardrive4.service.ScanService;

/**
* Launcher entry point.
Expand All @@ -52,14 +53,37 @@ public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

openWiFiFix();
try
{
openWiFiFix();
}
catch (Exception e)
{
// Must avoid to raise exceptions here, because in a new installation
// this script would not work (database not existing yet)
}

autoStartCheck();

startActivity(new Intent(this, MapViewer.class));
finish();

Log.i(TAG, "Created activity: Launcher");
}

/**
* Verifies if the auto start is enabled, and starts the service if it is.
*/
private void autoStartCheck()
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getApplication());
if (prefs.getBoolean(Settings.PREF_AUTO_START_SCAN, false))
{
Intent i = new Intent(this, ScanService.class);
startService(i);
}
}

/**
* Android (or someone else) changed how capabilities are printed and so
* open stuff is not recognized anymore.
Expand Down
1 change: 1 addition & 0 deletions apkmodule/src/ki/wardrive4/activity/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class Settings extends PreferenceActivity
public static final String PREF_FILTERFROMDATE = "filterfromdate";
public static final String PREF_WIGLE_USERNAME = "wigleUsername";
public static final String PREF_WIGLE_PASSWORD = "wiglePassword";
public static final String PREF_AUTO_START_SCAN = "autostartscan";

@Override
public void onBuildHeaders(List<Header> target)
Expand Down

0 comments on commit ba6d5a9

Please sign in to comment.