コード例 #1
0
  protected void syncToWebservice() {

    try {

      GPSTracker gps = new GPSTracker(getBaseContext());

      if (gps.canGetLocation()) {

        latitude = gps.getLatitude();
        longitude = gps.getLongitude();
        //
        //				 lat = String.valueOf(latitude);
        //				 lng = String.valueOf(longitude);
        //
        //				 share.saveLatfollow(lat);
        //				 share.saveLongfollow(lng);
        Location location = new Location("dummy provider");
        location.setLatitude(latitude);
        location.setLongitude(longitude);
        new GetAddressTask().execute(location);
      }
    } catch (Exception e) {
      // TODO: handle exception
      CommonFunctionMapid.displayToastshort(
          getApplicationContext(), e.getMessage(), Gravity.CENTER);
    }
  }
コード例 #2
0
  @Override
  public void onStart(Intent intent, int startId) {

    super.onStart(intent, startId);

    try {

      isRunning = true;
      mtTimer1 = new Timer();

      if (share.getFollowSync().equalsIgnoreCase("")) {

      } else {

        String timervalue = share.getFollowSync();
        String result = timervalue.replace(" ", "");
        int timer = Integer.parseInt(result);

        Log.e("timer service", "" + timer);

        int timeinmilli = timer * 60000;
        Log.e("timeinmilli service", "" + timeinmilli);

        mtTimer1.scheduleAtFixedRate(mTasker1, 0, timeinmilli);
      }
    } catch (Exception e) {
      // TODO: handle exception
      CommonFunctionMapid.displayToastshort(
          getApplicationContext(), e.getMessage(), Gravity.CENTER);
    }
  }
コード例 #3
0
        @Override
        public void run() {

          try {

            Looper.prepare();
            if (isRunning && CommonFunctionMapid.isInternetOn(getBaseContext())) {
              // checking if time scheduled
              // matches current time
              syncToWebservice(); // call updates
            }

          } catch (Exception e) {
            // TODO: handle exception
            CommonFunctionMapid.displayToastshort(
                getApplicationContext(), e.getMessage(), Gravity.CENTER);
          }
        }
コード例 #4
0
    @Override
    protected String doInBackground(Void... params) {

      String url = "profile/UpdateFollowMeAddress";
      try {
        JSONObject jobj = new JSONObject();

        jobj.put("ProfileId", profileid);
        JSONObject address = new JSONObject();
        address.put("AdminLevel1", adlevel1);
        address.put("AdminLevel2", adlevel2);
        address.put("Country", country);
        address.put("CountryCode", countryId);
        address.put("Lat", String.valueOf(latitude));
        address.put("Lng", String.valueOf(longitude));
        address.put("StreetAddress", streetadd);
        address.put("Locality", locality);
        address.put("PostalCode", postalcode);
        jobj.put("Address", address);

        String response =
            CommonFunctionMapid.postJsonResponse(url, jobj.toString(), getBaseContext());
        Log.e("TAG", "Response..." + response);

        JSONObject responseget = new JSONObject(response);

        JSONObject statusobj = responseget.getJSONObject("Status");

        Success = statusobj.getString("Success");
        message = statusobj.getString("Message");

      } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        CommonFunctionMapid.displayToastshort(
            getApplicationContext(), e.getMessage(), Gravity.CENTER);
      }
      return null;
    }
コード例 #5
0
    @Override
    protected void onPostExecute(String result) {
      // TODO Auto-generated method stub
      super.onPostExecute(result);
      try {

        new UpdateRedirectInBackGround().execute();
      } catch (Exception e) {
        // TODO: handle exception
        CommonFunctionMapid.displayToastshort(
            getApplicationContext(), e.getMessage(), Gravity.CENTER);
      }
    }
コード例 #6
0
  @Override
  public void onCreate() {
    super.onCreate();

    try {

      share = new com.mapid.utils.SharedPrefs(getBaseContext());
      profileid = share.getFollowingProfileid();
      // intent = new Intent(Constants.VIDEOBROADCAST);
      // share = new SharedPrefs(getBaseContext());
    } catch (Exception e) {
      // TODO: handle exception
      CommonFunctionMapid.displayToastshort(
          getApplicationContext(), e.getMessage(), Gravity.CENTER);
    }
  }