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"
package="com.TwentyCodes.android.LocationRinger"
android:installLocation="internalOnly"
android:versionCode="62"
android:versionName="6d759ee" >
android:versionCode="64"
android:versionName="ec647d5" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>

View File

@@ -6,19 +6,18 @@
*/
package com.TwentyCodes.android.LocationRinger.services;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import anroid.v4.compat.NotificationCompat;
import com.TwentyCodes.android.LocationRinger.R;
import com.TwentyCodes.android.LocationRinger.debug.Debug;
import com.TwentyCodes.android.LocationRinger.ui.ListActivity;
import com.TwentyCodes.android.LocationRinger.ui.SettingsActivity;
import com.TwentyCodes.android.SkyHook.SkyHookService;
import com.TwentyCodes.android.debug.LocationLibraryConstants;
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
* @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 SharedPreferences mSettings;
@@ -40,8 +39,8 @@ public class LocationService extends SkyHookService {
*/
public static Intent getSingleShotServiceIntent(Context context) {
return new Intent(context, LocationService.class)
.putExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, Debug.ACCURACY)
.setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE);
.putExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, Debug.ACCURACY)
.setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE);
}
/* (non-Javadoc)
@@ -85,10 +84,7 @@ public class LocationService extends SkyHookService {
* @author ricky barrette
*/
public static ComponentName startMultiShotService(final Context context){
Intent i = new Intent(context, LocationService.class)
.putExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, Debug.UPDATE_INTERVAL)
.putExtra(LocationLibraryConstants.INTENT_EXTRA_REQUIRED_ACCURACY, Debug.ACCURACY)
.setAction(LocationLibraryConstants.INTENT_ACTION_UPDATE);
Intent i = getSingleShotServiceIntent(context).putExtra(LocationLibraryConstants.INTENT_EXTRA_PERIOD_BETWEEN_UPDATES, Debug.UPDATE_INTERVAL);
return context.startService(i);
}
@@ -98,11 +94,17 @@ public class LocationService extends SkyHookService {
*/
private void startOnGoingNotification() {
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);
notifyDetails.setLatestEventInfo(this, this.getString(R.string.app_name), this.getString(R.string.gathering), intent);
notifyDetails.flags |= Notification.FLAG_ONGOING_EVENT;
this.mNotificationManager.notify(this.GATHERING_LOCATION_ONGING_NOTIFICATION_ID, notifyDetails);
final NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext())
.setContentTitle(getString(R.string.app_name))
.setContentText(this.getString(R.string.gathering))
.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.database.Cursor;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Parcelable;
import android.view.ContextMenu;
@@ -188,8 +187,8 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
new SkyHookRegistration(this).registerNewUser(this);
}
if(!this.getIntent().hasExtra(NO_SPLASH))
showSplashScreen();
// if(!this.getIntent().hasExtra(NO_SPLASH))
// showSplashScreen();
if(action != null)
if(action.equals(ACTION_NEW_RINGER))
@@ -409,32 +408,32 @@ public class ListActivity extends Activity implements OnItemClickListener, OnCli
setResult(RESULT_OK, intent);
}
/**
* Shows the splash screen over the full Activity
*/
protected void showSplashScreen() {
// mMap.setGPSDialogEnabled(false);
mSplashDialog = new Dialog(this, android.R.style.Theme_Translucent);
mSplashDialog.setContentView(R.layout.powered_by_skyhook);
mSplashDialog.setCancelable(false);
mSplashDialog.show();
// Set Runnable to remove splash screen just in case
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
removeSplashScreen();
/*
* uncomment the following to display the eula
*/
// //loads first boot dialog if this is the first boot
// if (! mSettings.getBoolean(Settings.ACCEPTED, false) || Debug.FORCE_FIRSTBOOT_DIALOG)
// eulaAlert();
// else
// update();
}
}, 2000);
}
// /**
// * Shows the splash screen over the full Activity
// */
// protected void showSplashScreen() {
//// mMap.setGPSDialogEnabled(false);
// mSplashDialog = new Dialog(this, android.R.style.Theme_Translucent);
// mSplashDialog.setContentView(R.layout.powered_by_skyhook);
// mSplashDialog.setCancelable(false);
// mSplashDialog.show();
//
// // Set Runnable to remove splash screen just in case
// final Handler handler = new Handler();
// handler.postDelayed(new Runnable() {
// @Override
// public void run() {
// removeSplashScreen();
//
// /*
// * uncomment the following to display the eula
// */
//// //loads first boot dialog if this is the first boot
//// if (! mSettings.getBoolean(Settings.ACCEPTED, false) || Debug.FORCE_FIRSTBOOT_DIALOG)
//// eulaAlert();
//// else
//// update();
// }
// }, 2000);
// }
}