@@ -0,0 +1,2755 @@
+package edu.sjsu.cohort3.cmpe295b.grp1.personalbigdata;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.apache.http.HttpResponse;%0Aimport org.apache.http.NameValuePair;%0Aimport org.apache.http.client.HttpClient;%0Aimport org.apache.http.client.entity.UrlEncodedFormEntity;%0Aimport org.apache.http.client.methods.HttpPost;%0Aimport org.apache.http.impl.client.DefaultHttpClient;%0Aimport org.apache.http.message.BasicNameValuePair;%0A%0Aimport android.app.Activity;%0Aimport android.os.Bundle;%0Aimport android.os.Handler;%0Aimport android.util.Log;%0Aimport android.view.Menu;%0Aimport android.widget.Toast;%0A%0Apublic class MainActivity extends Activity %7B%0A%0A    private final Runnable trackUser = new Runnable() %7B%0A        @Override%0A        public void run() %7B%0A            try %7B%0A                GPSTracker gpsTracker = new GPSTracker(getApplicationContext());%0A                if (gpsTracker.canGetLocation()) %7B%0A                    double latitude = gpsTracker.getLatitude();%0A                    double longitude = gpsTracker.getLongitude();%0A                    String msg = %22lat: %22 + latitude + %22, longitude: %22 + longitude;%0A                    Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();%0A                    HttpClient httpClient = new DefaultHttpClient();%0A                    HttpPost httpPost = new HttpPost(%22http://ec2-54-200-58-132.us-west-2.compute.amazonaws.com:3000/users%22);%0A                    List%3CNameValuePair%3E nameValuePairs = new ArrayList%3CNameValuePair%3E(4);%0A                    nameValuePairs.add(new BasicNameValuePair(%22user_id%22, %22123456789%22));%0A                    nameValuePairs.add(new BasicNameValuePair(%22device_id%22, %22987654321%22));%0A                    nameValuePairs.add(new BasicNameValuePair(%22latitude%22, String.valueOf(latitude)));%0A                    nameValuePairs.add(new BasicNameValuePair(%22longitude%22, String.valueOf(longitude)));%0A                    httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));%0A%0A                    Log.e(%22ANAND%22, %22before HTTP POST%22);%0A                    HttpResponse httpResponse = httpClient.execute(httpPost);%0A                    Log.e(%22ANAND%22, %22after HTTP POST%22);%0A                %7D%0A            %7D catch (Exception e) %7B%0A                Log.e(%22ANAND%22, e.getMessage());%0A            %7D%0A        %7D%0A    %7D;%0A%0A    @Override%0A    protected void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        setContentView(R.layout.activity_main);%0A        Handler r = new Handler();%0A        r.postDelayed(trackUser, 5000);%0A    %7D%0A%0A    @Override%0A    public boolean onCreateOptionsMenu(Menu menu) %7B%0A        // Inflate the menu; this adds items to the action bar if it is present.%0A        getMenuInflater().inflate(R.menu.main, menu);%0A        return true;%0A    %7D%0A%7D%0A

Create MainActivity.java