├── res ├── drawable-hdpi │ ├── icon.png │ ├── powered_by_google_on_black.png │ └── powered_by_google_on_white.png ├── drawable-ldpi │ ├── icon.png │ ├── powered_by_google_on_black.png │ └── powered_by_google_on_white.png ├── drawable-mdpi │ ├── icon.png │ ├── powered_by_google_on_black.png │ └── powered_by_google_on_white.png ├── values │ ├── booleans.xml │ └── strings.xml ├── values-v8 │ └── booleans.xml ├── menu │ └── main_menu.xml ├── anim-v11 │ ├── slide_out_right.xml │ └── slide_in_left.xml ├── layout │ ├── checkin_box.xml │ ├── place_detail.xml │ └── main.xml ├── layout-port │ └── main.xml └── layout-xlarge-port │ └── main.xml ├── .classpath ├── default.properties ├── .project ├── src └── com │ └── radioactiveyak │ └── location_best_practices │ ├── utils │ ├── base │ │ ├── IStrictMode.java │ │ ├── SharedPreferenceSaver.java │ │ ├── ILastLocationFinder.java │ │ └── LocationUpdateRequester.java │ ├── LegacySharedPreferenceSaver.java │ ├── LegacyStrictMode.java │ ├── GingerbreadSharedPreferenceSaver.java │ ├── HoneycombStrictMode.java │ ├── FroyoSharedPreferenceSaver.java │ ├── GingerbreadLocationUpdateRequester.java │ ├── FroyoLocationUpdateRequester.java │ ├── LegacyLocationUpdateRequester.java │ ├── PlatformSpecificImplementationFactory.java │ ├── LegacyLastLocationFinder.java │ └── GingerbreadLastLocationFinder.java │ ├── services │ ├── EclairPlacesUpdateService.java │ ├── CheckinNotificationService.java │ ├── PlaceDetailsUpdateService.java │ ├── PlaceCheckinService.java │ └── PlacesUpdateService.java │ ├── PlacesBackupAgent.java │ ├── PlacesApplication.java │ ├── receivers │ ├── NewCheckinReceiver.java │ ├── PowerStateChangedReceiver.java │ ├── BootReceiver.java │ ├── LocationChangedReceiver.java │ ├── ConnectivityChangedReceiver.java │ └── PassiveLocationChangedReceiver.java │ ├── UI │ ├── fragments │ │ ├── CheckinFragment.java │ │ ├── PlaceListFragment.java │ │ └── PlaceDetailFragment.java │ └── PlaceActivity.java │ ├── PlacesConstants.java │ └── content_providers │ ├── QueuedCheckinsContentProvider.java │ ├── PlacesContentProvider.java │ └── PlaceDetailsContentProvider.java ├── Readme.txt └── AndroidManifest.xml /res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anil-matcha/android-protips-location/master/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anil-matcha/android-protips-location/master/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anil-matcha/android-protips-location/master/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /res/drawable-hdpi/powered_by_google_on_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anil-matcha/android-protips-location/master/res/drawable-hdpi/powered_by_google_on_black.png -------------------------------------------------------------------------------- /res/drawable-hdpi/powered_by_google_on_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anil-matcha/android-protips-location/master/res/drawable-hdpi/powered_by_google_on_white.png -------------------------------------------------------------------------------- /res/drawable-ldpi/powered_by_google_on_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anil-matcha/android-protips-location/master/res/drawable-ldpi/powered_by_google_on_black.png -------------------------------------------------------------------------------- /res/drawable-ldpi/powered_by_google_on_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anil-matcha/android-protips-location/master/res/drawable-ldpi/powered_by_google_on_white.png -------------------------------------------------------------------------------- /res/drawable-mdpi/powered_by_google_on_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anil-matcha/android-protips-location/master/res/drawable-mdpi/powered_by_google_on_black.png -------------------------------------------------------------------------------- /res/drawable-mdpi/powered_by_google_on_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anil-matcha/android-protips-location/master/res/drawable-mdpi/powered_by_google_on_white.png -------------------------------------------------------------------------------- /res/values/booleans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | true 5 | 6 | -------------------------------------------------------------------------------- /res/values-v8/booleans.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | false 5 | 6 | -------------------------------------------------------------------------------- /res/menu/main_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /res/anim-v11/slide_out_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /res/anim-v11/slide_in_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Location Best Practices 4 | Refresh 5 | Checked in to 6 | Checkin 7 | 8 | 9 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /default.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 use, 7 | # "build.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-11 12 | -------------------------------------------------------------------------------- /res/layout/checkin_box.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 18 | 19 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Location_Best_Practices 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/com/radioactiveyak/location_best_practices/utils/base/IStrictMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.radioactiveyak.location_best_practices.utils.base; 18 | 19 | /** 20 | * This Interface definition allows you to create OS version-specific 21 | * implementations that offer the full Strict Mode functionality 22 | * available in each platform release. 23 | */ 24 | public interface IStrictMode { 25 | /** 26 | * Enable {@link StrictMode} using whichever platform-specific flags you wish. 27 | */ 28 | public void enableStrictMode(); 29 | } 30 | -------------------------------------------------------------------------------- /src/com/radioactiveyak/location_best_practices/services/EclairPlacesUpdateService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.radioactiveyak.location_best_practices.services; 18 | 19 | /** 20 | * {@inheritDoc} 21 | * Extends the {@link PlacesUpdateService} to force Intent redelivery 22 | * on Eclaire+ devices (where this defaults to false). 23 | */ 24 | public class EclairPlacesUpdateService extends PlacesUpdateService { 25 | @Override 26 | protected void setIntentRedeliveryMode(boolean enable) { 27 | setIntentRedelivery(true); 28 | } 29 | } -------------------------------------------------------------------------------- /src/com/radioactiveyak/location_best_practices/PlacesBackupAgent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.radioactiveyak.location_best_practices; 18 | 19 | import android.app.backup.BackupAgentHelper; 20 | import android.app.backup.SharedPreferencesBackupHelper; 21 | 22 | /** 23 | * A class that specifies which of the shared preferences you want to backup 24 | * to the Google Backup Service. 25 | */ 26 | public class PlacesBackupAgent extends BackupAgentHelper { 27 | @Override 28 | public void onCreate() { 29 | SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, PlacesConstants.SHARED_PREFERENCE_FILE); 30 | addHelper(PlacesConstants.SP_KEY_FOLLOW_LOCATION_CHANGES, helper); 31 | // TODO Add additional helpers for each of the preferences you want to backup. 32 | } 33 | } -------------------------------------------------------------------------------- /src/com/radioactiveyak/location_best_practices/utils/LegacySharedPreferenceSaver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.radioactiveyak.location_best_practices.utils; 18 | 19 | import android.content.Context; 20 | import android.content.SharedPreferences; 21 | import android.content.SharedPreferences.Editor; 22 | 23 | import com.radioactiveyak.location_best_practices.utils.base.SharedPreferenceSaver; 24 | 25 | /** 26 | * Save {@link SharedPreferences} in a way compatible with Android 1.6. 27 | */ 28 | public class LegacySharedPreferenceSaver extends SharedPreferenceSaver { 29 | 30 | public LegacySharedPreferenceSaver(Context context) { 31 | super(context); 32 | } 33 | 34 | /** 35 | * {@inheritDoc} 36 | */ 37 | @Override 38 | public void savePreferences(Editor editor, boolean backup) { 39 | editor.commit(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/com/radioactiveyak/location_best_practices/utils/LegacyStrictMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.radioactiveyak.location_best_practices.utils; 18 | 19 | import com.radioactiveyak.location_best_practices.utils.base.IStrictMode; 20 | 21 | import android.os.StrictMode; 22 | 23 | /** 24 | * Implementation that supports the Strict Mode functionality 25 | * available for the first platform release that supported Strict Mode. 26 | */ 27 | public class LegacyStrictMode implements IStrictMode { 28 | 29 | /** 30 | * Enable {@link StrictMode} 31 | * TODO Set your preferred Strict Mode features. 32 | */ 33 | public void enableStrictMode() { 34 | StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() 35 | .detectDiskReads() 36 | .detectDiskWrites() 37 | .detectNetwork() 38 | .penaltyLog() 39 | .build()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/com/radioactiveyak/location_best_practices/utils/GingerbreadSharedPreferenceSaver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.radioactiveyak.location_best_practices.utils; 18 | 19 | import android.content.Context; 20 | import android.content.SharedPreferences; 21 | 22 | /** 23 | * Save {@link SharedPreferences} using the asynchronous apply method available 24 | * in Gingerbread, and provide the option to notify the BackupManager to 25 | * initiate a backup. 26 | */ 27 | public class GingerbreadSharedPreferenceSaver extends FroyoSharedPreferenceSaver { 28 | 29 | public GingerbreadSharedPreferenceSaver(Context context) { 30 | super(context); 31 | } 32 | 33 | /** 34 | * {@inheritDoc} 35 | */ 36 | @Override 37 | public void savePreferences(SharedPreferences.Editor editor, boolean backup) { 38 | editor.apply(); 39 | backupManager.dataChanged(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/com/radioactiveyak/location_best_practices/utils/HoneycombStrictMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.radioactiveyak.location_best_practices.utils; 18 | 19 | import android.os.StrictMode; 20 | 21 | import com.radioactiveyak.location_best_practices.utils.base.IStrictMode; 22 | 23 | /** 24 | * Implementation that supports the Strict Mode functionality 25 | * available Honeycomb. 26 | */ 27 | public class HoneycombStrictMode implements IStrictMode { 28 | protected static String TAG = "HoneycombStrictMode"; 29 | 30 | /** 31 | * Enable {@link StrictMode} 32 | * TODO Set your preferred Strict Mode features. 33 | */ 34 | public void enableStrictMode() { 35 | StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() 36 | .detectDiskReads() 37 | .detectDiskWrites() 38 | .detectNetwork() 39 | .penaltyLog() 40 | .penaltyFlashScreen() 41 | .build()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/com/radioactiveyak/location_best_practices/PlacesApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.radioactiveyak.location_best_practices; 18 | 19 | import android.app.Application; 20 | 21 | import com.radioactiveyak.location_best_practices.utils.PlatformSpecificImplementationFactory; 22 | import com.radioactiveyak.location_best_practices.utils.base.IStrictMode; 23 | 24 | public class PlacesApplication extends Application { 25 | 26 | // TODO Insert your Google Places API into MY_API_KEY in PlacesConstants.java 27 | // TODO Insert your Backup Manager API into res/values/strings.xml : backup_manager_key 28 | 29 | @Override 30 | public final void onCreate() { 31 | super.onCreate(); 32 | 33 | if (PlacesConstants.DEVELOPER_MODE) { 34 | IStrictMode strictMode = PlatformSpecificImplementationFactory.getStrictMode(); 35 | if (strictMode != null) 36 | strictMode.enableStrictMode(); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/com/radioactiveyak/location_best_practices/utils/FroyoSharedPreferenceSaver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.radioactiveyak.location_best_practices.utils; 18 | 19 | import android.app.backup.BackupManager; 20 | import android.content.Context; 21 | import android.content.SharedPreferences; 22 | import android.content.SharedPreferences.Editor; 23 | 24 | /** 25 | * Save {@link SharedPreferences} and provide the option to notify 26 | * the BackupManager to initiate a backup. 27 | */ 28 | public class FroyoSharedPreferenceSaver extends LegacySharedPreferenceSaver { 29 | 30 | protected BackupManager backupManager; 31 | 32 | public FroyoSharedPreferenceSaver(Context context) { 33 | super(context); 34 | backupManager = new BackupManager(context); 35 | } 36 | 37 | /** 38 | * {@inheritDoc} 39 | */ 40 | @Override 41 | public void savePreferences(Editor editor, boolean backup) { 42 | editor.commit(); 43 | backupManager.dataChanged(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /res/layout/place_detail.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 |