call logs and gps maps android
<p>I am fairly new to java/android and I am trying to implement a simple app that will take the current gps location when a call comes in or is placed and send them to a database. the app will work something like: 
1)call comes in
2)the call logs the gps co ordinates to a database
3)and finally
4)a pinpoint is placed on that gps point with the number.
the gps mapping is fine and I have an idea of how to send them to a database from the pinpoint but I am finding actually setting up the call log to take the gps at the time of the call to be the hardest part.
this is the code I have been working with for the call log part.</p>

<pre><code>import java.sql.Connection;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.provider.BaseColumns;
import android.provider.Contacts.People;
import android.text.TextUtils;
import android.util.Log;

public class CallLog {
    public static final String AUTHORITY = "call_log";
    public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);

    public static class Calls implements BaseColumns {

        public static final Uri CONTENT_URI = Uri
                .parse("content://call_log/calls");

        public static final Uri CONTENT_FILTER_URI = Uri
                .parse("content://call_log/calls/filter");

        public static final String DEFAULT_SORT_ORDER = "date DESC";

        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/calls";

        public static final String CONTENT_ITEM_TYPE = vnd.android.cursor.item/calls";

        public static final String TYPE = "type";

        public static final int INCOMING_TYPE = 1;
        public static final int OUTGOING_TYPE = 2;
        public static final int MISSED_TYPE = 3;

        public static final String NUMBER = "number";

        public static final String DATE = "date";

        public static final String DURATION = "duration";

        public static final String NEW = "new";

        public static final String CACHED_NAME = "name";

        public static final String CACHED_NUMBER_TYPE = "numbertype";

        public static final String CACHED_NUMBER_LABEL = "numberlabel";

        public static Uri addCall(CallerInfo ci, Context context,
                String number, int presentation, int callType, long start,
                int duration) {
            final ContentResolver resolver = context.getContentResolver();

            if (TextUtils.isEmpty(number)) {
                if (presentation == Connection.PRESENTATION_RESTRICTED) {
                    number = CallerInfo.PRIVATE_NUMBER;
                } else if (presentation == Connection.PRESENTATION_PAYPHONE) {
                    number = CallerInfo.PAYPHONE_NUMBER;
                } else {
                    number = CallerInfo.UNKNOWN_NUMBER;
                }
            }
            ContentValues values = new ContentValues();

            values.put(NUMBER, number);
            values.put(TYPE, Integer.valueOf(callType));
            values.put(DATE, Long.valueOf(start));
            values.put(DURATION, Long.valueOf(duration));
            values.put(NEW, Integer.valueOf(1));
            if (ci != null) {
                values.put(CACHED_NAME, ci.name);
                values.put(CACHED_NUMBER_TYPE, ci.numberType);
                values.put(CACHED_NUMBER_LABEL, ci.numberLabel);
            }
            if ((ci != null) &amp;&amp; (ci.person_id &gt; 0)) {
                People.markAsContacted(resolver, ci.person_id);
            }
            Uri result = resolver.insert(CONTENT_URI, values);
            removeExpiredEntries(context);
            return result;
        }

        private static void removeExpiredEntries(Context context) {
            final ContentResolver resolver = context.getContentResolver();
            resolver.delete(CONTENT_URI, "_id IN " + "(SELECT_id FROM calls ORDER BY "+" LIMIT -1 OFFSET 500)", null);
        }
    }

}
</code></pre>

<p>any advice or criticism is welcome on how to approach this or how to change the code I am working with.
thank you in advance for any help.</p>
