Log.e(TAG, "Error while creating a URL", e);
return;
}
+
+
+ mCallbackText = new TextView(this);
+ this.doBindService();
+
+
+
+
+
webServiceConnection = new MobieAdHttpClient(this.myCookie, url, httpClient, this, syncObject);
this.exec.execute(webServiceConnection);
- mCallbackText = new TextView(this);
- this.doBindService();
+
}
// Establish a connection with the service. We use an explicit
// class name because there is no reason to be able to let other
// applications replace our component.
- bindService(new Intent(NextActivity.this,
+ boolean prueba = bindService(new Intent(NextActivity.this,
TestService.class), mConnection, Context.BIND_AUTO_CREATE);
+ System.out.print(prueba);
mIsBound = true;
mCallbackText.setText("Binding.");
}
import java.util.ArrayList;
import android.app.Notification;
import android.app.NotificationManager;
-import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.Messenger;
import android.os.RemoteException;
import android.widget.Toast;
-import android.app.Notification;
public class TestService extends Service {
}
@Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+
+ //Run the same code as MobieAdHttpclient.java
+
+ // If we get killed, after returning from here, restart
+ return START_STICKY;
+ }
+
+ @Override
public void onDestroy() {
// Cancel the persistent notification.
mNM.cancel(R.string.remote_service_started);
*/
@Override
public IBinder onBind(Intent intent) {
- try {
- synchronized (this) {
- this.wait(10000);
- }
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
return mMessenger.getBinder();
}
// We use a string id because it is a unique number. We use it later to cancel.
mNM.notify(R.string.remote_service_started, notification);
}
-
}