Need backround running process
<p>Actually I have written a method for updatiing server database using webservice from my application installed in the device using two IP Address.If one IP failed then it usess the second IP for upadting the data at server.
If Both the IP address failed i am saving the data to one of my sqllite database table tblTransaction.The code for that is given below.</p>

<pre><code>private void Delay15Minute() throws IOException {
        String server1IPAddress = "";
        String server2IPAddress = "";
        String deviceId = "";
        Cursor cursorAdmin;
        Cursor cursorTransaction;
        adminhelper = new admin_helper(this);
        cursorAdmin = adminhelper.GetAdminDetails();
        if (cursorAdmin.moveToFirst())
            server1IPAddress = cursorAdmin.getString(cursorAdmin
                    .getColumnIndex("RemoteServer1IPAddress"));
        server2IPAddress = cursorAdmin.getString(cursorAdmin
                .getColumnIndex("RemoteServer2IPAddress"));
        deviceId = cursorAdmin.getString(cursorAdmin
                .getColumnIndex("DeviceID"));
        cursorAdmin.close();




        ContentValues initialDelay15 = new ContentValues();
        ContentValues initialTransaction = new ContentValues();
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
        String RevisedEstimatedDate = sdf.format(date);



        manifest_helper = new manifest_helper(this);
        cursor = manifest_helper.GetDeliveries(pkManifest);
        cursor.moveToFirst();
         dbAdapter = new DatabaseAdapter(this); 
         dbAdapter.open();

        for (int i = 0; i &lt; cursor.getCount(); i++) {
            cursor.getString(cursor.getColumnIndex("PKDelivery"));
            String RevisedTime=cursor.getString(cursor.getColumnIndex("RevisedEstimatedDeliveryTime"));     

            // get hour and minute from time string
            StringTokenizer st1 = new StringTokenizer(RevisedTime, ":");
            int j = 0;
            int[] val = new int[st1.countTokens()];
            // iterate through tokens
            while (st1.hasMoreTokens()) {
                val[j] = Integer.parseInt(st1.nextToken());
                j++;
            }

            // call time add method with current hour, minute and minutesToAdd,
            // return added time as a string
            String dateRevisedEstimatedDeliveryTime = addTime(val[0], val[1], 15);
            initialDelay15.put("RevisedEstimatedDeliveryTime",
                    dateRevisedEstimatedDeliveryTime);


             dbAdapter.UpdateRecord("tblDelivery", initialDelay15, "PKDelivery"
             + "=" + cursor.getString(cursor.getColumnIndex("PKDelivery")), null);


        }
        dbAdapter.close();
        dataXmlExporter=new DataXmlExporter(this);
        dataXmlExporter.StartDataSet();     
        cursor = manifest_helper.GetDeliveries(pkManifest);
        dataXmlExporter.AddRowandColumns(cursor,"tblDelivery");

        String sqlTransaction = "Select 6 as TransactionType,'Update Revised Estimated Delivery Time' as Description,"
                + " deviceId as DeviceID ,date() as TransactionUploadDate,time() as TransactionUploadTime from tblAdmin where PKAdmin &gt; ?";

        dbAdapter = new DatabaseAdapter(this); 
        dbAdapter.open();
        cursorTransaction = dbAdapter.ExecuteRawQuery(sqlTransaction, "-1");
        dataXmlExporter.AddRowandColumns(cursorTransaction, "Transaction");



        String XMLTransactionData=dataXmlExporter.EndDataSet();     

        try {

            if ((server1IPAddress != "") &amp;&amp; (server2IPAddress != "")) {
                try {
                    if (server1IPAddress != "") {
                        InsertUploadedTrancasctionDetails(server1IPAddress,
                                deviceId, XMLTransactionData);
                    }
                } catch (Exception exception) {

                    if ((server1IPAddress != server2IPAddress)
                            &amp;&amp; (server2IPAddress != "")) {
                        InsertUploadedTrancasctionDetails(server2IPAddress,
                                deviceId, XMLTransactionData);
                    }
                }

            }
        } catch (Exception exception) {

            initialTransaction.put("ReceivedDate",
                    RevisedEstimatedDate);
            initialTransaction.put("TransactionData",
                    XMLTransactionData);            
            dbAdapter.InsertRecord("tblTransaction", "",
                    initialTransaction);



        } 
        dbAdapter.close();

        LoadDeliveries(pkManifest);
    }
</code></pre>

<p>The Problem is that i need to update the data to the server that stored in the tbltransaction automatically when we get connection to the serverIP along with my running application.I think it is possible by means of establishing backround running process along with my application that will check whethere data is there in the tbltransaction and connection with server is there.</p>

<p>So will any one have an idea for this ...if so please help meee...........</p>
