Android Open Source - spotastop Login Service






From Project

Back to project page spotastop.

License

The source code is released under:

MIT License

If you think the Android project spotastop listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.cipciop.spotastop.services;
//from  w ww  .j a va2s.c o m
import java.util.ArrayList;

import requests.Criteria;
import resources.Resource;
import rest.RestApi;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

import com.cipciop.spotastop.StopSpotApp;
import com.cipciop.spotastop.domain.User;

public class LoginService extends Service {

  @Override
  public IBinder onBind(Intent arg0) {
    return null;
  }

  public int onStartCommand(Intent intent, int flags, int startid) {
    new Thread(new Runnable() {
      public void run() {
        User newUser = new User();
        Criteria c = new Criteria();
        c.addConstraint("resClass", "cipciop\\spotastop\\User");
        c.addConstraint("username", StopSpotApp.getInstance()
            .getInsertedUsername());

        ArrayList<Resource> users = RestApi.queryResources(c);
        if (users.size() > 0) {
          if (((User) users.get(0)).login(StopSpotApp.getInstance()
              .getInsertedUsername(), StopSpotApp.getInstance()
              .getInsertedPassword())) {
            StopSpotApp.getInstance().setLoggedUser(
                (User) users.get(0));
          } else {
            StopSpotApp.getInstance().setLoggedUser(null);
          }
        } else {
          StopSpotApp.getInstance().setLoggedUser(null);
        }

      }
    }).start();

    return 0;
  }
}




Java Source Code List

.LoaderTester.java
com.cipciop.spotastop.ErrorActivity.java
com.cipciop.spotastop.LoginActivity.java
com.cipciop.spotastop.RegisterActivity.java
com.cipciop.spotastop.SelectBusLine.java
com.cipciop.spotastop.SpotActivity.java
com.cipciop.spotastop.StopSpotApp.java
com.cipciop.spotastop.domain.BusStop.java
com.cipciop.spotastop.domain.GeoPos.java
com.cipciop.spotastop.domain.Line.java
com.cipciop.spotastop.domain.User.java
com.cipciop.spotastop.presentation.BusLineItem.java
com.cipciop.spotastop.services.JarvisDynDnsService.java
com.cipciop.spotastop.services.LoginService.java
com.cipciop.spotastop.services.RegistrationService.java
com.cipciop.spotastop.services.RetrieveLinesListService.java
com.cipciop.spotastop.services.SpotBusStopService.java
com.nicfix.gsoncompatibility.GsonConfigurator.java
requests.CreatorRequest.java
requests.Criteria.java
requests.Data.java
requests.EditorRequest.java
requests.Link.java
requests.LinkerRequest.java
requests.LoaderRequest.java
requests.StorerRequest.java
requests.Unlink.java
requests.beContentRequest.java
resources.Resource.java
resources.ResourcesCache.java
resources.ResourcesMapper.java
responses.AsyncCallback.java
responses.beContentResponse.java
rest.RestApi.java
settings.Settings.java