Can't find .jar file for jumblr (Tumblr android wrapper)
Date : March 29 2020, 07:55 AM
|
Getting html of tumblr post using jumblr
Date : March 29 2020, 07:55 AM
it fixes the issue I am developing my first Android application using the "jumblr" library to get the last post of a blog and then do some stuff. , I solved the problem casting the post to a TextPost. List<Post> posts = client.blogPosts("blogname.tumblr.com");
String post = (TextPost)posts.get(0).getBody();
|
Jumblr Implementation android
Date : March 29 2020, 07:55 AM
hop of those help? to Clinkz. Its pretty forward up there in these links but if still someone is having issue , this is the code which I used in my Android app and its working fine. For Android at 1st we have to add these two line in app level gradle file: implementation 'com.daksh:loglr:2.1.4' private void loginToTumblr() {
Loglr loglr = Loglr.INSTANCE;
if(loglr != null) {
loglr.setConsumerKey("TUBMLR_CONSUMER_KEY"); // Replace with your App's Key
loglr.setConsumerSecretKey("TUBMLR_CONSUMER_SECRET"); // Replace with your App's Key
loglr.setUrlCallBack("https://www.callback.com/"); // Replace with your App's Callback
loglr.setLoginListener(new LoginListener() {
@Override
public void onLoginSuccessful(com.tumblr.loglr.LoginResult loginResult) {
String oAuthToken = loginResult.getOAuthToken();
String oAuthTokenSecret = loginResult.getOAuthTokenSecret();
Log.w(TAG, oAuthToken + "\n" + oAuthTokenSecret);
shareOnTumblr(oAuthToken , oAuthTokenSecret);
}
});
loglr.setExceptionHandler(new ExceptionHandler() {
@Override
public void onLoginFailed(RuntimeException e) {
Log.e(TAG, "Loglr Exeception: " + e.getMessage());
Toast.makeText(this, "Sorry! can't login to the tumblr.", Toast.LENGTH_LONG).show();
}
});
loglr.initiate(this);
}
else
Toast.makeText(this, "Something went wrong while Loggin in to Tumblr.", Toast.LENGTH_LONG).show();
}
private void shareOnTumblr(String token, String tokenSecret) {
IResult iResult = new IResult() {
@Override
public void onSuccess(String result) {
loadingBar.hide();
Toast.makeText(this, result, Toast.LENGTH_LONG).show();
}
@Override
public void onError(String error) {
Toast.makeText(this, error, Toast.LENGTH_LONG).show();
}
};
String caption = "IMAGE CAPTION GOES HERE";
String imagePath = "IMAGE PATH GOES HERE"; //It must a String
String params[] = new String[]{token, tokenSecret , caption, imagePath};
new TumblrPostAsyncTask(iResult).execute(params);
}
public static class TumblrPostAsyncTask extends AsyncTask<String, String, Boolean> {
IResult iResult;
TumblrPostAsyncTask(IResult iResult){
this.iResult = iResult;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected Boolean doInBackground(String... params) {
boolean result;
try {
JumblrClient client = new JumblrClient("TUBMLR_CONSUMER_KEY", "TUBMLR_CONSUMER_SECRET");
client.setToken(params[0], params[1]);
PhotoPost post = client.newPost(client.user().getBlogs().get(0).getName(),PhotoPost.class);
Log.w(TAG, params[2] + " " + params[3]);
post.setCaption(params[2]);
post.setData(new File(params[3]));
post.save();
result = true;
} catch (Exception e) {
Log.w(TAG, "Tumblr's Error: " + e.getMessage());
result = false;
}
return result;
}
@Override
protected void onPostExecute(Boolean success) {
super.onPostExecute(success);
Log.w(TAG, "On Post Execute: " + success);
if(success)
iResult.onSuccess("Successfully Posted on Tumblr.");
else
iResult.onError("Sorry! couldn't Post on Tumblr.");
}
}
public interface IResult {
void onSuccess(String result);
void onError(String error);
}
|
Get "is_nsfw" flag from jumblr client for a tumblr blog
Date : March 29 2020, 07:55 AM
I hope this helps . So, turns out this really is not supported by the JumblrClient, currently. If anyone else stumbles across this until it is resolved in a new version, I now ended up getting that info by querying directly via api.tumblr.com/v2/blog/{blog-identifier}/info?api_key={key} as described here https://www.tumblr.com/docs/en/api/v2#blog-info
|
Android-Tumblr API - Jumblr for Android [OAuthConnectionException]
Date : March 29 2020, 07:55 AM
|