src/com/beem/project/beem/BeemService.java
changeset 33 0e65d5f55d2f
parent 32 4d26854143e2
parent 21 b9f4a0ef574a
child 38 3e76846c48a9
--- a/src/com/beem/project/beem/BeemService.java	Fri Mar 20 23:21:05 2009 +0100
+++ b/src/com/beem/project/beem/BeemService.java	Sat Mar 21 02:09:05 2009 +0100
@@ -10,6 +10,8 @@
 import org.jivesoftware.smack.Roster;
 import org.jivesoftware.smack.RosterListener;
 import org.jivesoftware.smack.packet.Presence;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
 
 import android.app.Notification;
 import android.app.NotificationManager;
@@ -25,10 +27,9 @@
 import com.beem.project.beem.service.XMPPConnectionAdapter;
 import com.beem.project.beem.service.aidl.IXMPPConnection;
 import com.beem.project.beem.service.aidl.IXMPPFacade;
-
 /**
  * @author darisk
- *
+ * 
  */
 public class BeemService extends Service {
 
@@ -39,6 +40,7 @@
     private String mLogin;
     private String mPassword;
     private String mHost;
+
     private IXMPPFacade.Stub bind = new IXMPPFacade.Stub() {
 
 	@Override
@@ -46,7 +48,6 @@
 	    return connection;
 	}
 
-
 	@Override
 	public void disconnect() throws RemoteException {
 	    connection.disconnect();
@@ -90,6 +91,19 @@
 	notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
 	connection = new XMPPConnectionAdapter("10.0.2.2"); // address
     }
+    
+    private void showBasicNotification(int stringResource) {
+        String text = (String) getText(stringResource);
+        Notification notif = new Notification(R.drawable.logo, text, System
+                .currentTimeMillis());
+        notif.defaults = Notification.DEFAULT_ALL;
+        notif.setLatestEventInfo(this, text, text, PendingIntent.getActivity(
+                this, 0, new Intent(), 0));
+        notificationManager.notify(stringResource, notif);
+        Toast toast = Toast.makeText(this, R.string.BeemServiceCreated,
+                Toast.LENGTH_LONG);
+        toast.show();
+    }
 
     @Override
     public void onStart(Intent intent, int startId) {
@@ -107,16 +121,6 @@
 	showBasicNotification(R.string.BeemServiceDestroyed);
     }
 
-    private void showBasicNotification(int stringResource) {
-	String text = (String) getText(stringResource);
-	Notification notif = new Notification(R.drawable.logo, text, System
-		.currentTimeMillis());
-	notif.defaults = Notification.DEFAULT_ALL;
-	notif.setLatestEventInfo(this, text, text, PendingIntent.getActivity(
-		this, 0, new Intent(), 0));
-	notificationManager.notify(stringResource, notif);
-    }
-
     private void closeConnection() {
 	if (connection != null)
 	    try {