Uygulamamda kullandığım kod bu şekilde :
[code]
public class UserGridController {
// API url:
// This is the url of the server where you have usergrid running.
// You can see all usergrid activity from the usergrid
// console: http://usergrid.github.com/console/?api_url=insert_your_api_url
private String USERGRID_API_URL = "https://api.turkcell.com.tr/usergrid";
// Application name:
// This is the name you selected when you set up the usergrid application
// It is reassigned when a new server url is entered while running the app.
// It is grabbed as the
// last segment of the API URL that the user enters.
private String ORGNAME = "ffurkan.tanriverdi";
private String APPNAME = "KOydummu";
private String USERGRID_APP = ORGNAME + "/" + APPNAME;
private ApigeeClient apigeeClient;
private DataClient client;
// This method initializes Apigee client for communication with an api url.
// Only one client is created and used by all the applications views to
// communicate with usergrid.
public void initialize(Context context) {
this.apigeeClient = new ApigeeClient(ORGNAME,APPNAME,USERGRID_API_URL,context);
this.client = this.apigeeClient.getDataClient();
}
public ApigeeClient getApigeeClient() {
return apigeeClient;
}
public void setApigeeClient(ApigeeClient apigeeClient) {
this.apigeeClient = apigeeClient;
}
/*public UserGridController(){
client = new DataClient(USERGRID_APP).withApiUrl(USERGRID_API_URL);
}*/
public ApiResponse login(String kullaniciAdi, String sifre) {
// TODO Auto-generated method stub
ApiResponse response = null;
// attempt to authorize user
try {
response = client.authorizeAppUser(kullaniciAdi, sifre); // null dönüyor
} catch (Exception e) {
System.out.println("exception caught: " + e.getLocalizedMessage());
response = null;
}
if( response != null) {
String error = response.getError();
if( error != null ) {
System.out.println("login error: '" + error + "'");
}
} else {
System.out.println("login response is null");
}
// if response shows success, store account info
if ((response != null) && !"invalid_grant".equals(response.getError())) {
User user = response.getUser();
String email = user.getEmail();
String username = user.getUsername();
String imageURL = user.getPicture();
}
// return login response
return response;
}
[/code]