Started removing skyhook location services from the project

This commit is contained in:
2012-07-21 22:44:35 -04:00
parent ec647d52bf
commit c708c3dc00
3 changed files with 48 additions and 47 deletions

View File

@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.TwentyCodes.android.LocationRinger" package="com.TwentyCodes.android.LocationRinger"
android:installLocation="internalOnly" android:installLocation="internalOnly"
android:versionCode="62" android:versionCode="64"
android:versionName="6d759ee" > android:versionName="ec647d5" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>

View File

@@ -6,19 +6,18 @@
*/ */
package com.TwentyCodes.android.LocationRinger.services; package com.TwentyCodes.android.LocationRinger.services;
import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import anroid.v4.compat.NotificationCompat;
import com.TwentyCodes.android.LocationRinger.R; import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.debug.Debug; import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.ui.ListActivity; import com.TwentyCodes.android.LocationRinger.ui.ListActivity;
import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity; import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity;
import com.TwentyCodes.android.SkyHook.SkyHookService;
import com.TwentyCodes.android.debug.LocationLibraryConstants; import com.TwentyCodes.android.debug.LocationLibraryConstants;
import com.TwentyCodes.android.exception.ExceptionHandler; import com.TwentyCodes.android.exception.ExceptionHandler;
@@ -26,7 +25,7 @@ import com.TwentyCodes.android.exception.ExceptionHandler;
* We override the location service so we can attach the exception handler * We override the location service so we can attach the exception handler
* @author ricky barrette * @author ricky barrette
*/ */
public class LocationService extends SkyHookService { public class LocationService extends com.TwentyCodes.android.location.LocationService {
private final int GATHERING_LOCATION_ONGING_NOTIFICATION_ID = 232903877; private final int GATHERING_LOCATION_ONGING_NOTIFICATION_ID = 232903877;
private SharedPreferences mSettings; private SharedPreferences mSettings;
@@ -40,8 +39,8 @@ public class LocationService extends SkyHookService {
*/ */
public static Intent getSingleShotServiceIntent(Context context) { public static Intent getSingleShotServiceIntent(Context context) {
return new Intent(context, LocationService.class) return new Intent(context, LocationService.class)
.putExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, Debug.ACCURACY) .putExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, Debug.ACCURACY)
.setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE); .setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE);
} }
/* (non-Javadoc) /* (non-Javadoc)
@@ -85,10 +84,7 @@ public class LocationService extends SkyHookService {
* @author ricky barrette * @author ricky barrette
*/ */
public static ComponentName startMultiShotService(final Context context){ public static ComponentName startMultiShotService(final Context context){
Intent i = new Intent(context, LocationService.class) Intent i = getSingleShotServiceIntent(context).putExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, Debug.UPDATE_INTERVAL);
.putExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, Debug.UPDATE_INTERVAL)
.putExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, Debug.ACCURACY)
.setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE);
return context.startService(i); return context.startService(i);
} }
@@ -98,11 +94,17 @@ public class LocationService extends SkyHookService {
*/ */
private void startOnGoingNotification() { private void startOnGoingNotification() {
this.mNotificationManager = (NotificationManager) this.getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE); this.mNotificationManager = (NotificationManager) this.getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
Notification notifyDetails = new Notification(R.drawable.icon, this.getString(R.string.app_name), System.currentTimeMillis());
PendingIntent intent = PendingIntent.getActivity(this, 0, new Intent(this, ListActivity.class), android.content.Intent.FLAG_ACTIVITY_NEW_TASK); final NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext())
notifyDetails.setLatestEventInfo(this, this.getString(R.string.app_name), this.getString(R.string.gathering), intent); .setContentTitle(getString(R.string.app_name))
notifyDetails.flags |= Notification.FLAG_ONGOING_EVENT; .setContentText(this.getString(R.string.gathering))
this.mNotificationManager.notify(this.GATHERING_LOCATION_ONGING_NOTIFICATION_ID, notifyDetails); .setTicker(this.getString(R.string.gathering))
.setSmallIcon(R.drawable.icon)
.setContentIntent(PendingIntent.getActivity(this, 0, new Intent(this, ListActivity.class), android.content.Intent.FLAG_ACTIVITY_NEW_TASK))
.setWhen(System.currentTimeMillis())
.setOngoing(true);
this.mNotificationManager.notify(this.GATHERING_LOCATION_ONGING_NOTIFICATION_ID, builder.getNotification());
} }
/** /**

View File

@@ -16,7 +16,6 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.Cursor; import android.database.Cursor;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.Parcelable; import android.os.Parcelable;
import android.view.ContextMenu; import android.view.ContextMenu;
@@ -188,8 +187,8 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
new SkyHookRegistration(this).registerNewUser(this); new SkyHookRegistration(this).registerNewUser(this);
} }
if(!this.getIntent().hasExtra(NO_SPLASH)) // if(!this.getIntent().hasExtra(NO_SPLASH))
showSplashScreen(); // showSplashScreen();
if(action != null) if(action != null)
if(action.equals(ACTION_NEW_RINGER)) if(action.equals(ACTION_NEW_RINGER))
@@ -409,32 +408,32 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
setResult(RESULT_OK, intent); setResult(RESULT_OK, intent);
} }
/** // /**
* Shows the splash screen over the full Activity // * Shows the splash screen over the full Activity
*/ // */
protected void showSplashScreen() { // protected void showSplashScreen() {
// mMap.setGPSDialogEnabled(false); //// mMap.setGPSDialogEnabled(false);
mSplashDialog = new Dialog(this, android.R.style.Theme_Translucent); // mSplashDialog = new Dialog(this, android.R.style.Theme_Translucent);
mSplashDialog.setContentView(R.layout.powered_by_skyhook); // mSplashDialog.setContentView(R.layout.powered_by_skyhook);
mSplashDialog.setCancelable(false); // mSplashDialog.setCancelable(false);
mSplashDialog.show(); // mSplashDialog.show();
//
// Set Runnable to remove splash screen just in case // // Set Runnable to remove splash screen just in case
final Handler handler = new Handler(); // final Handler handler = new Handler();
handler.postDelayed(new Runnable() { // handler.postDelayed(new Runnable() {
@Override // @Override
public void run() { // public void run() {
removeSplashScreen(); // removeSplashScreen();
//
/* // /*
* uncomment the following to display the eula // * uncomment the following to display the eula
*/ // */
// //loads first boot dialog if this is the first boot //// //loads first boot dialog if this is the first boot
// if (! mSettings.getBoolean(Settings.ACCEPTED, false) || Debug.FORCE_FIRSTBOOT_DIALOG) //// if (! mSettings.getBoolean(Settings.ACCEPTED, false) || Debug.FORCE_FIRSTBOOT_DIALOG)
// eulaAlert(); //// eulaAlert();
// else //// else
// update(); //// update();
} // }
}, 2000); // }, 2000);
} // }
} }