// Register the listener with the Location Manager to receive location updates
locationManager.requestLocationUpdates(0, 10, criteria, locationListener, null);
+
+
+
+ //mCallbackText = new TextView(this);
+ //this.doBindService();
}
return;
}
-
- mCallbackText = new TextView(this);
- this.doBindService();
-
-
-
-
-
webServiceConnection = new MobieAdHttpClient(this.myCookie, url, httpClient, this, syncObject);
this.exec.execute(webServiceConnection);
-
-
-
-
-
-
-
-
-
}
// applications replace our component.
boolean prueba = bindService(new Intent(NextActivity.this,
TestService.class), mConnection, Context.BIND_AUTO_CREATE);
- System.out.print(prueba);
mIsBound = true;
mCallbackText.setText("Binding.");
}
CookieSyncManager.getInstance().sync();
//Go to the next activity
StrictMode.setThreadPolicy(currentPolicy);
- this.startActivity(new Intent(Intent.ACTION_RUN).
- setComponent(new ComponentName("de.android.test3", "de.android.test3.NextActivity")));
+// this.startService(new Intent(Test3Activity.this, TestService.class));
+// this.startActivity(new Intent(Intent.ACTION_RUN).
+// setComponent(new ComponentName("de.android.test3", "de.android.test3.NextActivity")));
+ this.startService(new Intent(Intent.ACTION_RUN).
+ setComponent(new ComponentName("de.android.test3", "de.android.test3.TestService")));
+ this.finish();
} else {
Log.e(TAG, "There must be a weird issue with the server because... There is not cookie!!!!");
createErrorDialog(R.string.error_dialog_connection_error);
import java.util.ArrayList;
import android.app.Notification;
import android.app.NotificationManager;
+import android.app.PendingIntent;
import android.app.Service;
+import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
@Override
public void onCreate() {
- mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
+ mNM = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
// Display a notification about us starting.
showNotification();
CharSequence text = getText(R.string.remote_service_started);
// Set the icon, scrolling text and timestamp
- Notification notification = new Notification(R.drawable.alert_dialog_icon, text,
- System.currentTimeMillis());
+ Notification notification = new Notification(R.drawable.alert_dialog_icon, text, System.currentTimeMillis());
// The PendingIntent to launch our activity if the user selects this notification
- //PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
- // new Intent(this, Controller.class), 0);
+ PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, NextActivity.class), 0);
+
+ Context context = getApplicationContext();
// Set the info for the views that show in the notification panel.
- //notification.setLatestEventInfo(this, getText(R.string.remote_service_label),
- // text, contentIntent);
+ notification.setLatestEventInfo(context, getText(R.string.remote_service_label), text, contentIntent);
+ notification.defaults |= Notification.DEFAULT_VIBRATE;
+ notification.ledARGB = 0xff00ff00;
+ notification.ledOnMS = 300;
+ notification.ledOffMS = 1000;
+ notification.flags |= Notification.FLAG_SHOW_LIGHTS;
+
// Send the notification.
// We use a string id because it is a unique number. We use it later to cancel.