I've been following the example code on https://github.com/box/box-android-sdk/ as well as the documentation. However whenever I try to upload a file to box.com I receive the following error:
11-13 18:25:45.222 20996-21555/com.caa.capturebox W/System.err: com.box.androidsdk.content.BoxException: An error occurred while sending the request (401)
11-13 18:25:45.237 20996-21555/com.caa.capturebox W/System.err: at com.box.androidsdk.content.requests.BoxRequestUpload.send(BoxRequestUpload.java:114)
11-13 18:25:45.238 20996-21555/com.caa.capturebox W/System.err: at com.caa.capturebox.MainActivity$5.run(MainActivity.java:441)
Below is the last attempt I made however whether I try to upload from an input stream or from a local file I get the same error above.
private void uploadFile() {
mDialog = ProgressDialog.show(MainActivity.this, getText(R.string.boxsdk_Please_wait), getText(R.string.boxsdk_Please_wait));
new Thread() {
#Override
public void run() {
try {
Log.e("mya", "uploadFile: entered try");
FileInputStream uploadStream = new FileInputStream(image_name);
//InputStream uploadStream = getResources().getAssets().open(uploadFileName);
String destinationFolderId = "0";
String uploadName = "BoxSDKUpload.jpg";
//BoxRequestsFile.UploadFile request = mFileApi.getUploadRequest(uploadStream, uploadName, destinationFolderId);
BoxRequestsFile.UploadFile request = mFileApi.getUploadRequest(image_name, "0");
final BoxFile uploadFileInfo = request.send();
showToast("Uploaded " + uploadFileInfo.getName());
loadRootFolder();
} catch (IOException e) {
e.printStackTrace();
} catch (BoxException e) {
e.printStackTrace();
BoxError error = e.getAsBoxError();
if (error != null && error.getStatus() == HttpStatus.SC_CONFLICT) {
ArrayList<BoxEntity> conflicts = error.getContextInfo().getConflicts();
if (conflicts != null && conflicts.size() == 1 && conflicts.get(0) instanceof BoxFile) {
//uploadNewVersion((BoxFile) conflicts.get(0));
return;
}
}
showToast("Upload failed");
} finally {
mDialog.dismiss();
}
}
}.start();
}
since you have (401) response, I assume that it's Not Authorized http code returned. Have you been login to box : box login documentation
Please login in order to use box services with this code:
BoxSession session = new BoxSession(context);
session.authenticate();
Related
I am sending variables from ajax to java! in my ajax method I am sending 2 variables: idtabPrest and idPolice!
I am getting an error exception because I am not passing the File ! how can I make this function work and read the variables even if i am not sending the File.
I commented the Try/catch of the file to pass the variables! but in some ajax methods I am using the file.
public String upload_via_ajax() {
try {
String property = "java.io.tmpdir";
String tempDir = System.getProperty(property);
String html = "inside upload via ajax";
// try {
// File destFile = new File(tempDir, myFileFileName.substring(0,
// myFileFileName.lastIndexOf(".")) + ".csv");
// FileUtils.copyFile(myFile, destFile);
//
// getRequest().getSession().setAttribute("filePath",
// destFile.getPath());
//POUR REFERENCE DECLARATION
if(annee != null) {
TableReferentielDto tableReferentielDto = new TableReferentielDto();
tableReferentielDto.setId(Long.parseLong(annee));
TableReferentielDto anneeLabel =(TableReferentielDto) tableReferentielGetByIdCmd
.execute(tableReferentielDto);
getRequest().getSession().setAttribute("annee",
anneeLabel.getLibelle());
}
//POUR DATE DEBUT DECLARATION
if(moisDebutDeclaration != null){
getRequest().getSession().setAttribute("moisDebutDeclaration",
moisDebutDeclaration);
}
//POUR DATE FIN DECLARATION
if(moisFinDeclaration != null){
getRequest().getSession().setAttribute("moisFinDeclaration",
moisFinDeclaration);
}
//ID POLICE
if(idPolice != null){
getRequest().getSession().setAttribute("idPolice",
idPolice);
}
if(idTabPrest != null) {
getRequest().getSession().setAttribute("idTabPrest",
idTabPrest);
}
if(idTabTarif != null){
getRequest().getSession().setAttribute("idTabTarif",
idTabTarif);
}
html = "file uploaded";
// } catch (IOException e) {
//
// html = "error in uploading file";
// e.printStackTrace();
// }
return SUCCESS;
} catch (Exception e) {
return SUCCESS;
}
}
I am using Gmail api and many users are complaining that sending emails does not work. For most users it works fine and I am not able to reproduce the issue. In Firebase I get the following crash report.
Non-fatal Exception: com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException
at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:297)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:868)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
at com.dummydomain.myapp.EmailUtils.sendMessage(EmailUtils.java:397)
(...)
Caused by com.google.android.gms.auth.d: NeedPermission
at com.google.android.gms.auth.zze.zzb(zze.java:13)
at com.google.android.gms.auth.zzd.zza(zzd.java:77)
at com.google.android.gms.auth.zzd.zzb(zzd.java:20)
at com.google.android.gms.auth.zzd.getToken(zzd.java:7)
at com.google.android.gms.auth.zzd.getToken(zzd.java:5)
at com.google.android.gms.auth.zzd.getToken(zzd.java:2)
at com.google.android.gms.auth.GoogleAuthUtil.getToken(GoogleAuthUtil.java:55)
at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken(GoogleAccountCredential.java:267)
at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:292)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:868)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
at com.dummydomain.myapp.EmailUtils.sendMessage(EmailUtils.java:397)
(...)
Below are the essentials of my authentication process. Manifest.permission.GET_ACCOUNTS is already granted at this point, and the appropriate API things in the Google Cloud Console are correctly configured and my app is verified for using the sensitive permission/scope GMAIL_SEND.
private void authenticate() {
String[] SCOPES = {GmailScopes.GMAIL_SEND};
GoogleAccountCredential mCredential = GoogleAccountCredential.usingOAuth2(
context,
Arrays.asList(SCOPES))
.setBackOff(new ExponentialBackOff());
startActivityForResult(mCredential.newChooseAccountIntent(),REQUEST_ACCOUNT_PICKER);
}
// which returns in
public void onActivityResult(...) {
// (...)
switch(requestCode) {
case REQUEST_ACCOUNT_PICKER:
if (resultCode == Activity.RESULT_OK && data != null && data.getExtras() != null) {
String accountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
if (accountName != null) {
// Check if not a gmail account, since gmail api only works with that gmail accounts...
if(!accountName.contains("#gmail.com") && !accountName.contains("#googlemail.com")){
// --> tell user to select a google account
return;
}
mCredential.setSelectedAccount(new Account(accountName, BuildConfig.APPLICATION_ID));
// Got account, now test if we have access
new CheckAccessTask().execute();
}else{
// (...)
}
}
break;
case REQUEST_AUTHORIZATION:
if (resultCode != Activity.RESULT_OK) {
// choose new account
startActivityForResult(mCredential.newChooseAccountIntent(), REQUEST_ACCOUNT_PICKER);
}else{
// Got authorization, so test email
new CheckAccessTask().execute();
}
break;
}
}
private class CheckAccessTask extends AsyncTask<Void, Void, Boolean> {
private Exception mLastError = null;
#Override
protected Boolean doInBackground(Void... params) {
try {
// Check if we got token - will crash with UserRecoverableAuthException
// if user didn't accept the google consent screen
mCredential.getToken();
// access granted, return true
return true;
} catch (Exception e) {
mLastError = e;
cancel(true);
return false;
}
}
#Override
protected void onCancelled() {
if (mLastError != null) {
if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
// Play Services not found --> cancel activation
} else if (mLastError instanceof UserRecoverableAuthException) {
startActivityForResult(((UserRecoverableAuthException) mLastError).getIntent(), REQUEST_AUTHORIZATION);
} else if (mLastError instanceof UserRecoverableAuthIOException) {
startActivityForResult(((UserRecoverableAuthIOException) mLastError).getIntent(), REQUEST_AUTHORIZATION);
} else {
// Other error --> cancel activation
}
} else {
// --> cancel activation
}
}
#Override
protected void onPostExecute(Boolean accessGranted) {
if (accessGranted){
// SUCCESS! Save email in shared preferences for later use
String accountName = mCredential.getSelectedAccountName();
prefs.putString(Constants.SENDER_ACCOUNT, accountName);
}
}
}
Essentials of sending email process (in actual code emails are HTML)
private void sendEmail(){
GoogleAccountCredential mCredential = GoogleAccountCredential.usingOAuth2(
context,
Arrays.asList(SCOPES))
.setBackOff(new ExponentialBackOff());
// set sender account
String senderAccount = prefs.getString(Constants.SENDER_ACCOUNT, null);
if(senderAccount == null) return; // Authentication not complete
mCredential.setSelectedAccount(new Account(senderAccount, BuildConfig.APPLICATION_ID));
// Initialize service object
HttpTransport transport = AndroidHttp.newCompatibleTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
Gmail mGmailApiService = new Gmail.Builder(
transport, jsonFactory, mCredential)
.setApplicationName("My-App")
.build();
// Construct email
com.google.api.services.gmail.model.Message message;
try {
// create MimeMessage
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
MimeMessage mimeMessage = new MimeMessage(session);
mimeMessage.setSubject("Test email");
mimeMessage.setText("Hello this is an email sent from android");
mimeMessage.setFrom(new InternetAddress(mCredential.getSelectedAccountName()));
mimeMessage.setRecipients(javax.mail.Message.RecipientType.TO, InternetAddress.parse(senderAccount)); // send to yourself
// Convert MimeMessage to Message
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
mimeMessage.writeTo(bytes);
String encodedEmail = Base64.encodeBase64URLSafeString(bytes.toByteArray());
message = new com.google.api.services.gmail.model.Message();
message.setRaw(encodedEmail);
} catch (MessagingException | IOException e) {
e.printStackTrace();
return;
}
// Send email
try {
mGmailApiService.users().messages().send("me", message).execute(); // (EmailUtils:397)
// Success, email sent!
} catch (IOException e) {
e.printStackTrace();
// ==== THIS is where users get UserRecoverableAuthIOExceptions ==== //
}
}
With firebase logging I've found out that the crash happens both shortly after authentication as well long after. I can also see that it sometimes happens that the code sends one email successfully and then crashes on the next one right after. I also get quite a few reports of SocketTimeoutException which I believe are caused by slow/faulty internet connection though.
Thank you for your time.
EDIT:
The only way I am able to reproduce the error is by manually removing my app from the list of "Third-party apps with account access". But I don't see why this should happen without user interaction.
I want to test if website has data in it or it's invalid link in android studio. For example:
Has data:
https://media-cdn.tripadvisor.com/media/photo-o/03/d8/a8/70/zinfandel-s.jpg
Has no data cause link is invalid:
https://media-cdn.tripadvisor.com/media/po/03/d8/a8/70/zdel-s.jpg
We can also use java.net.url class to validate a URL. A MalformedURLExceptio will be thrown if no protocol is specified, or an unknown protocol is found, or spec is null. Then we will call method toURI()that will throw a URISyntaxException if the URL cannot be converted to URI
class URLValidator {
public static boolean urlValidator(String url) {
try {
new URL(url).toURI();
return true;
}
catch (URISyntaxException exception) {
return false;
}
catch (MalformedURLException exception) {
return false;
}
}
public static void main(String[] args)
{
String url = "https://media-cdn.tripadvisor.com/media/po/03/d8/a8/70/zdel-s.jpg";
if (urlValidator(url))
System.out.print("The given URL: " + url + " , contain image.");
else
System.out.print("The given URL: " + url + " , is not contain image.");
}
}
well, you can use okhttp library for maing http-requests.
here's the snippet for you:
private final OkHttpClient client = new OkHttpClient();
public void run() throws Exception {
Request request = new Request.Builder()
.url("https://media-cdn.tripadvisor.com/media/po/03/d8/a8/70/zdel-s.jpg")
.build();
try (Response response = client.newCall(request).execute()) {
if (!response.isSuccessful()) {
//this will run if image is not available
}
}
}
Hi I am developing android app using java restfull webservices Here I am getting one issue in calling web service through post method when I use client.post("") my all values get null while calling webservice. I dont know why it is happening. And when I use client.get("") its working properly.And I am able to do register properly through client.get. But I want to use client.post Please help me let me know what I am mistaking.
public void registerUser(View view){
String name = nameET.getText().toString();
String email = emailET.getText().toString();
String password = pwdET.getText().toString();
RequestParams params = new RequestParams();
if(Utility.isNotNull(name) && Utility.isNotNull(email) && Utility.isNotNull(password)){
if(Utility.validate(email)){
control
params.put("name", name);
params.put("username", email);
params.put("password", password);
// Invoke RESTful Web Service with Http parameters
invokeWS(params);
}
}
public void invokeWS(RequestParams params){
System.out.println("params===== "+params);
prgDialog.show();
**AsyncHttpClient client = new AsyncHttpClient();
client.post("http://localhost:8080/DemoForAndroid/register/doregister",params ,new AsyncHttpResponseHandler()** {
// When the response returned by REST has Http response code '200'
public void onSuccess(String response) {
// Hide Progress Dialog
System.out.println("response======= "+response);
prgDialog.hide();
try {
// JSON Object
JSONObject obj = new JSONObject(response);
// When the JSON response has status boolean value assigned with true
if(obj.getBoolean("status")){
// Set Default Values for Edit View controls
setDefaultValues();
// Display successfully registered message using Toast
Toast.makeText(getApplicationContext(), "You are successfully registered!", Toast.LENGTH_LONG).show();
}
// Else display error message
else{
errorMsg.setText(obj.getString("error_msg"));
Toast.makeText(getApplicationContext(), obj.getString("error_msg"), Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
// TODO Auto-generated catch block
Toast.makeText(getApplicationContext(), "Error Occured [Server's JSON response might be invalid]!", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
// When the response returned by REST has Http response code other than '200'
public void onFailure(int statusCode, Throwable error,
String content) {
// Hide Progress Dialog
prgDialog.hide();
// When Http response code is '404'
if(statusCode == 404){
Toast.makeText(getApplicationContext(), "Requested resource not found", Toast.LENGTH_LONG).show();
}
// When Http response code is '500'
else if(statusCode == 500){
Toast.makeText(getApplicationContext(), "Something went wrong at server end", Toast.LENGTH_LONG).show();
}
// When Http response code other than 404, 500
else{
Toast.makeText(getApplicationContext(), "Unexpected Error occcured! [Most common Error: Device might not be connected to Internet or remote server is not up and running]", Toast.LENGTH_LONG).show();
}
}
});
System.out.println("Client======= "+client);
}
log file
01-28 12:10:26.307: W/KeyCharacterMap(106): No keyboard for id 0
01-28 12:10:26.307: W/KeyCharacterMap(106): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
01-28 12:11:33.238: I/System.out(274): params===== username=raju#mail.com&name=Raju &password=123456
01-28 12:11:33.328: D/dalvikvm(274): GC_FOR_MALLOC freed 5941 objects / 275504 bytes in 57ms
01-28 12:11:33.378: I/System.out(274): Client======= com.loopj.android.http.AsyncHttpClient#44ef5638
01-28 12:11:33.578: I/System.out(274): response======= {"tag":"register","status":false,"error_msg":"Error occured"}
01-28 12:11:33.678: I/ARMAssembler(58): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x360af8:0x360bb4] in 405396 ns
01-28 12:11:33.745: W/InputManagerService(58): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#450aa070
Restful Webservice code
#Path("/register")
public class Register {
// HTTP Get Method
User usr = new User();
#POST
// Path: http://localhost/<appln-folder-name>/register/doregister
#Path("/doregister")
// Produces JSON as response
#Produces(MediaType.APPLICATION_JSON)
// Query parameters are parameters: http://localhost/<appln-folder-name>/register/doregister?name=pqrs&username=abc&password=xyz
public String doLogin(#QueryParam("name") String name, #QueryParam("username") String uname, #QueryParam("password") String pwd){
String response = "";
System.out.println("Inside doLogin "+uname+" "+pwd);
int retCode = registerUser(name, uname, pwd);
System.out.println("ret code= "+retCode);
if(retCode == 0){
response = Utitlity.constructJSON("register",true);
}else if(retCode == 1){
response = Utitlity.constructJSON("register",false, "You are already registered");
}else if(retCode == 2){
response = Utitlity.constructJSON("register",false, "Special Characters are not allowed in Username and Password");
}else if(retCode == 3){
response = Utitlity.constructJSON("register",false, "Error occured");
}
return response;
}
private int registerUser(String name, String uname, String pwd){
System.out.println("Inside checkCredentials");
System.out.println("name= "+name);
System.out.println("uname= "+uname);
System.out.println("pwd= "+pwd);
int result = 3;
if(Utitlity.isNotNull(uname) && Utitlity.isNotNull(pwd)){
try {
System.out.println("add user---------------");
/* if(DBConnection.insertUser(name, uname, pwd)){*/
usr.setName(name);
usr.setUsername(uname);
usr.setPassword(pwd);
new UserDao().addUser(usr);
System.out.println("RegisterUSer if");
result = 0;
/* }*/
} /*catch(SQLException sqle){
System.out.println("RegisterUSer catch sqle");
//When Primary key violation occurs that means user is already registered
if(sqle.getErrorCode() == 1062){
result = 1;
}
//When special characters are used in name,username or password
else if(sqle.getErrorCode() == 1064){
System.out.println(sqle.getErrorCode());
result = 2;
}
}*/
catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("Inside checkCredentials catch e ");
result = 3;
}
}else{
System.out.println("Inside checkCredentials else");
result = 3;
}
return result;
}
}
webservice log
Inside doLogin null null
Inside checkCredentials
name= null
uname= null
pwd= null
Inside isNotNull
Inside checkCredentials else
ret code= 3
replace #QueryParam with #FormParam in doLogin()
i think #QueryParam will be more like a GET param expected.
I am trying to add a feature to my android app that allows users to "checkin" with other people tagged to the checkin.
I have the checkins method working no problem and can tag some one by adding the user ID as a parameter (see code below)
public void postLocationTagged(String msg, String tags, String placeID, Double lat, Double lon) {
Log.d("Tests", "Testing graph API location post");
String access_token = sharedPrefs.getString("access_token", "x");
try {
if (isSession()) {
String response = mFacebook.request("me");
Bundle parameters = new Bundle();
parameters.putString("access_token", access_token);
parameters.putString("place", placeID);
parameters.putString("Message",msg);
JSONObject coordinates = new JSONObject();
coordinates.put("latitude", lat);
coordinates.put("longitude", lon);
parameters.putString("coordinates",coordinates.toString());
parameters.putString("tags", tags);
response = mFacebook.request("me/checkins", parameters, "POST");
Toast display = Toast.makeText(this, "Checkin has been posted to Facebook.", Toast.LENGTH_SHORT);
display.show();
Log.d("Tests", "got response: " + response);
if (response == null || response.equals("") ||
response.equals("false")) {
Log.v("Error", "Blank response");
}
} else {
// no logged in, so relogin
Log.d(TAG, "sessionNOTValid, relogin");
mFacebook.authorize(this, PERMS, new LoginDialogListener());
}
} catch(Exception e) {
e.printStackTrace();
}
}
This works fine (I've posted it in case it is of help to anyone else!), the problem i am having is i am trying to create a list of the users friends so they can select the friends they want to tag. I have the method getFriends (see below) which i am then going to use to generate an AlertDialog that the user can select from which in turn will give me the id to use in the above "postLocationTagged" method.
public void getFriends(CharSequence[] charFriendsNames,CharSequence[] charFriendsID, ProgressBar progbar) {
pb = progbar;
try {
if (isSession()) {
String access_token = sharedPrefs.getString("access_token", "x");
friends = charFriendsNames;
friendsID = charFriendsID;
Log.d(TAG, "Getting Friends!");
String response = mFacebook.request("me");
Bundle parameters = new Bundle();
parameters.putString("access_token", access_token);
response = mFacebook.request("me/friends", parameters, "POST");
Log.d("Tests", "got response: " + response);
if (response == null || response.equals("") ||
response.equals("false")) {
Log.v("Error", "Blank response");
}
} else {
// no logged in, so relogin
Log.d(TAG, "sessionNOTValid, relogin");
mFacebook.authorize(this, PERMS, new LoginDialogListener());
}
} catch(Exception e) {
e.printStackTrace();
}
}
When i look at the response in the log it reads:
"got responce: {"error":{"type":"OAuthException", "message":"(#200) Permissions error"}}"
I have looked through the graphAPI documentation and searched for similar questions but to no avail! I'm not sure if i need to request extra permissions for the app or if this is something your just not allowed to do! Any help/suggestions would be greatly appreciated.
You might need the following permissions:
user_checkins
friends_checkins
read_friendlists
manage_friendlists
publish_checkins
Check the related ones from the API docs. Before that, make sure that which line causes this permission error and try to fix it.
The solution is to implement a RequestListener when making the request to the Facebook graph API. I have the new getFriends() method (see below) which uses the AsyncGacebookRunner to request the data.
public void getFriends(CharSequence[] charFriendsNames,String[] sFriendsID, ProgressBar progbar) {
try{
//Pass arrays to store data
friends = charFriendsNames;
friendsID = sFriendsID;
pb = progbar;
Log.d(TAG, "Getting Friends!");
//Create Request with Friends Request Listener
mAsyncRunner.request("me/friends", new FriendsRequestListener());
} catch (Exception e) {
Log.d(TAG, "Exception: " + e.getMessage());
}
}
The AsyncFacebookRunner makes the the request using the custom FriendsRequestListener (see below) which implements the RequestListener class;
private class FriendsRequestListener implements RequestListener {
String friendData;
//Method runs when request is complete
public void onComplete(String response, Object state) {
Log.d(TAG, "FriendListRequestONComplete");
//Create a copy of the response so i can be read in the run() method.
friendData = response;
//Create method to run on UI thread
FBConnectActivity.this.runOnUiThread(new Runnable() {
public void run() {
try {
//Parse JSON Data
JSONObject json;
json = Util.parseJson(friendData);
//Get the JSONArry from our response JSONObject
JSONArray friendArray = json.getJSONArray("data");
//Loop through our JSONArray
int friendCount = 0;
String fId, fNm;
JSONObject friend;
for (int i = 0;i<friendArray.length();i++){
//Get a JSONObject from the JSONArray
friend = friendArray.getJSONObject(i);
//Extract the strings from the JSONObject
fId = friend.getString("id");
fNm = friend.getString("name");
//Set the values to our arrays
friendsID[friendCount] = fId;
friends[friendCount] = fNm;
friendCount ++;
Log.d("TEST", "Friend Added: " + fNm);
}
//Remove Progress Bar
pb.setVisibility(ProgressBar.GONE);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FacebookError e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
}
Feel free to use any of this code in your own projects, or ask any questions about it.
You can private static final String[] PERMISSIONS = new String[] {"publish_stream","status_update",xxxx};xxx is premissions