├── .gitignore ├── ic_launcher-web.png ├── libs ├── gson-2.2.4.jar ├── android-support-v4.jar └── libGoogleAnalyticsServices.jar ├── res ├── drawable-hdpi │ ├── ic_launcher.png │ ├── ic_notification.png │ ├── current_location_dark.png │ └── current_location_light.png ├── drawable-mdpi │ ├── ic_launcher.png │ ├── ic_notification.png │ ├── current_location_dark.png │ └── current_location_light.png ├── drawable-xhdpi │ ├── ic_launcher.png │ ├── ic_notification.png │ ├── current_location_dark.png │ └── current_location_light.png ├── drawable-xxhdpi │ ├── ic_launcher.png │ ├── ic_notification.png │ ├── current_location_dark.png │ └── current_location_light.png ├── values │ ├── attrs.xml │ ├── dimens.xml │ ├── analytics.xml │ ├── styles.xml │ ├── settings.xml │ └── strings.xml ├── values-sw600dp │ └── dimens.xml ├── values-sw720dp-land │ └── dimens.xml ├── values-v14 │ └── styles.xml ├── layout │ ├── dialog_loadlocation.xml │ ├── dialog_savelocation.xml │ └── activity_main.xml ├── xml │ └── settings.xml └── menu │ └── main.xml ├── src └── com │ └── vellut │ └── geoalarm │ ├── GeoAlarmBootServiceStarter.java │ ├── AlarmWakeUpBroadcastReceiver.java │ ├── ReceiveTransitionsBroadcastReceiver.java │ ├── SavedLocation.java │ ├── io │ ├── LatLngBoundsSerializer.java │ └── LatLngBoundsDeserializer.java │ ├── GeoAlarmBootService.java │ ├── GeoAlarmUtils.java │ ├── SettingsActivity.java │ ├── ReceiveTransitionsIntentService.java │ ├── AlarmWakeUpService.java │ ├── GeoAlarm.java │ ├── SwipeDismissListViewTouchListener.java │ └── MainActivity.java ├── project.properties ├── proguard-project.txt ├── MIT-LICENSE.txt ├── README.md ├── AndroidManifest.xml ├── icon_notification.svg └── icon_app.svg /.gitignore: -------------------------------------------------------------------------------- 1 | .settings 2 | .project 3 | .classpath 4 | /gen 5 | /bin 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/ic_launcher-web.png -------------------------------------------------------------------------------- /libs/gson-2.2.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/libs/gson-2.2.4.jar -------------------------------------------------------------------------------- /libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/libs/android-support-v4.jar -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /libs/libGoogleAnalyticsServices.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/libs/libGoogleAnalyticsServices.jar -------------------------------------------------------------------------------- /res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-hdpi/ic_notification.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-mdpi/ic_notification.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-xhdpi/ic_notification.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/ic_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-xxhdpi/ic_notification.png -------------------------------------------------------------------------------- /res/drawable-hdpi/current_location_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-hdpi/current_location_dark.png -------------------------------------------------------------------------------- /res/drawable-hdpi/current_location_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-hdpi/current_location_light.png -------------------------------------------------------------------------------- /res/drawable-mdpi/current_location_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-mdpi/current_location_dark.png -------------------------------------------------------------------------------- /res/drawable-mdpi/current_location_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-mdpi/current_location_light.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/current_location_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-xhdpi/current_location_dark.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/current_location_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-xhdpi/current_location_light.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/current_location_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-xxhdpi/current_location_dark.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/current_location_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gvellut/MapAlarmist/HEAD/res/drawable-xxhdpi/current_location_light.png -------------------------------------------------------------------------------- /res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /res/values/analytics.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | UA-46221369-1 5 | true 6 | true 7 | 8 | -------------------------------------------------------------------------------- /res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /res/layout/dialog_loadlocation.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | -------------------------------------------------------------------------------- /src/com/vellut/geoalarm/GeoAlarmBootServiceStarter.java: -------------------------------------------------------------------------------- 1 | package com.vellut.geoalarm; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | 7 | public class GeoAlarmBootServiceStarter extends BroadcastReceiver { 8 | 9 | @Override 10 | public void onReceive(Context context, Intent intent) { 11 | Intent i = new Intent(); 12 | i.setClass(context, GeoAlarmBootService.class); 13 | context.startService(i); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /res/xml/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | -------------------------------------------------------------------------------- /res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | android.library.reference.1=../google-play-services_lib 16 | -------------------------------------------------------------------------------- /src/com/vellut/geoalarm/AlarmWakeUpBroadcastReceiver.java: -------------------------------------------------------------------------------- 1 | package com.vellut.geoalarm; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.support.v4.content.WakefulBroadcastReceiver; 6 | import android.util.Log; 7 | 8 | public class AlarmWakeUpBroadcastReceiver extends WakefulBroadcastReceiver { 9 | 10 | @Override 11 | public void onReceive(Context context, Intent intent) { 12 | // Do nothing 13 | Log.d(GeoAlarmUtils.APPTAG, "Received Alarm Notification"); 14 | Intent launchService = new Intent(); 15 | launchService.setClass(context, AlarmWakeUpService.class); 16 | startWakefulService(context, launchService); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/com/vellut/geoalarm/ReceiveTransitionsBroadcastReceiver.java: -------------------------------------------------------------------------------- 1 | package com.vellut.geoalarm; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.support.v4.content.WakefulBroadcastReceiver; 6 | import android.util.Log; 7 | 8 | public class ReceiveTransitionsBroadcastReceiver extends 9 | WakefulBroadcastReceiver { 10 | 11 | @Override 12 | public void onReceive(Context context, Intent intent) { 13 | Intent service = new Intent(context, ReceiveTransitionsIntentService.class); 14 | Log.d(GeoAlarmUtils.APPTAG, "in ReceiveTransBrodcastReceiver"); 15 | service.putExtras(intent); 16 | startWakefulService(context, service); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/com/vellut/geoalarm/SavedLocation.java: -------------------------------------------------------------------------------- 1 | package com.vellut.geoalarm; 2 | 3 | import com.google.android.gms.maps.model.LatLngBounds; 4 | 5 | public class SavedLocation implements Comparable { 6 | public String description; 7 | public LatLngBounds zone; 8 | 9 | public SavedLocation() { 10 | } 11 | 12 | public SavedLocation(String description, LatLngBounds zone) { 13 | this.description = description; 14 | this.zone = zone; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return description; 20 | } 21 | 22 | @Override 23 | public int compareTo(SavedLocation another) { 24 | return (this.description.compareTo(another.description)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /res/layout/dialog_savelocation.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 17 | 18 | -------------------------------------------------------------------------------- /res/values/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Low Power 5 | Balanced Power / Accuracy 6 | High Accuracy (GPS) 7 | 8 | 9 | 10 | @string/lowpower 11 | @string/balancedpowacc 12 | @string/highaccuracy 13 | 14 | 15 | @string/balancedpowacc 16 | 17 | lowpower 18 | balancedpowacc 19 | highaccuracy 20 | 21 | -------------------------------------------------------------------------------- /proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /src/com/vellut/geoalarm/io/LatLngBoundsSerializer.java: -------------------------------------------------------------------------------- 1 | package com.vellut.geoalarm.io; 2 | 3 | import java.lang.reflect.Type; 4 | 5 | 6 | import com.google.android.gms.maps.model.LatLngBounds; 7 | import com.google.gson.JsonArray; 8 | import com.google.gson.JsonElement; 9 | import com.google.gson.JsonPrimitive; 10 | import com.google.gson.JsonSerializationContext; 11 | import com.google.gson.JsonSerializer; 12 | 13 | public class LatLngBoundsSerializer implements JsonSerializer { 14 | 15 | @Override 16 | public JsonElement serialize(LatLngBounds zone, Type arg1, 17 | JsonSerializationContext arg2) { 18 | JsonArray arr = new JsonArray(); 19 | arr.add(new JsonPrimitive(zone.southwest.latitude)); 20 | arr.add(new JsonPrimitive(zone.southwest.longitude)); 21 | arr.add(new JsonPrimitive(zone.northeast.latitude)); 22 | arr.add(new JsonPrimitive(zone.northeast.longitude)); 23 | return arr; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 15 | 16 | 21 | 22 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/com/vellut/geoalarm/io/LatLngBoundsDeserializer.java: -------------------------------------------------------------------------------- 1 | package com.vellut.geoalarm.io; 2 | 3 | import java.lang.reflect.Type; 4 | 5 | import com.google.android.gms.maps.model.LatLng; 6 | import com.google.android.gms.maps.model.LatLngBounds; 7 | import com.google.gson.JsonArray; 8 | import com.google.gson.JsonDeserializationContext; 9 | import com.google.gson.JsonDeserializer; 10 | import com.google.gson.JsonElement; 11 | import com.google.gson.JsonParseException; 12 | 13 | public class LatLngBoundsDeserializer implements JsonDeserializer{ 14 | 15 | @Override 16 | public LatLngBounds deserialize(JsonElement element, Type arg1, 17 | JsonDeserializationContext arg2) throws JsonParseException { 18 | JsonArray arr = element.getAsJsonArray(); 19 | LatLng southwest = new LatLng(arr.get(0).getAsDouble(), arr.get(1).getAsDouble()); 20 | LatLng northeast = new LatLng(arr.get(2).getAsDouble(), arr.get(3).getAsDouble()); 21 | LatLngBounds zone = new LatLngBounds(southwest, northeast); 22 | return zone; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2013 Guilhem Vellut 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## About 2 | Map Alarmist is a simple location-based alarm app. It is distributed in the Google Play store: https://play.google.com/store/apps/details?id=com.vellut.geoalarm 3 | It is my first Android project and I used it to learn some aspects of the platform. 4 | 5 | It includes examples of usage for the following: 6 | - Google Maps (using the Google Play Services) 7 | - Location Client (using the Google Play Services), with Location Updates and Location Geofencing 8 | - Launching broadcast receiver at boot 9 | - Using the Alarm Manager to wake up the device 10 | - Swipe to delete in a ListView 11 | - Preference screen 12 | - Saving and reading to/from SharedPreferences 13 | - Displaying the Alarm Picker dialog 14 | 15 | ## Using the app 16 | Use the map to select the area where the alarm should be triggered then select a sound and whether the phone should vibrate. Flip the switch at the bottom to set the alarm. Once inside the area, the phone will notify you. This application works even when another app is open or when the phone is sleeping. 17 | 18 | Additional features include: 19 | - Save preferred locations for quick retrieval 20 | - Choose the location technique: Precise location using GPS, battery saving mode or a balanced accuracy/power technique. 21 | 22 | ## Compiling the app 23 | Import the code into the Eclise ADT using the "Import... > Existing Android Code into Workspace" tool. 24 | 25 | ## Running 26 | Generate a Google API key (used for Google Maps) for your debug and release signing keys. Replace the key inside the AndroidManifest.xml file. 27 | Replace the AdMob tracking key inside the res/layout/activity_main.xml file 28 | Create a Google Analytics configuration for the app and replace the tracking key inside the res/values/analytics.xml file 29 | 30 | 31 | -------------------------------------------------------------------------------- /res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Map Alarmist 5 | Choose ringtone 6 | Vibrate 7 | Select ringtone for alarm 8 | Position 9 | Click to return to app 10 | Map Alarmist has been triggered 11 | Geofencing Error: %d 12 | Welcome to Map Alarmist.\n\nUse the map to select the area where the alarm should be triggered and select a sound.\n\nFlip the switch at the bottom to set the alarm. 13 | OK 14 | Cancel 15 | OFF 16 | ON 17 | Load location 18 | Save location 19 | Location description 20 | Location saved 21 | Enter a description for the location 22 | Load location 23 | Save location 24 | Settings 25 | Unable to obtain location 26 | 27 | Location technique 28 | 29 | -------------------------------------------------------------------------------- /res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 22 | 23 |