#4 Daily issues in android- Twitter asterisk issue in a status update
Issue:
Just make API request via StatusService#update
with a status string including asterisk "*".
This request will return following response
{ "errors": [{ "code": 32, "message": "Could not authenticate you." }]}
My Proposed Solution:
After seeing some suggestions about URL Encoding. I’m trying to encode the asterisk (*) character using %2A. but It doesn’t work for me.
So Just replace the asterisk *
with the wide-asterisk *
. It is perfectly working for me
// An abstract method to updates the authenticating user's current status, also known as tweeting.@FormUrlEncoded
@POST("/1.1/statuses/update.json")
void update(@Field("status") String status,
@Field("in_reply_to_status_id") Long inReplyToStatusId,
@Field("possibly_sensitive") Boolean possiblySensitive,
@Field("lat") Double latitude,
@Field("long") Double longitude,
@Field("place_id") String placeId,
@Field("display_cooridnates") Boolean displayCoordinates,
@Field("trim_user") Boolean trimUser,
@Field("media_ids") String mediaIds,
Callback<Tweet> cb);// Replacing the '*' with the wide-asterisk '*'String tweet_text="Tweet text with asterisk *";
tweet_text= tweet_text.replaceAll("[*]","*");
// Initialization of StatusesService
//Please assume twitterclient is non null objectStatusesService statusesService = twitterApiClient.getStatusesService();// A method to update the tweet statusstatusesService.update(tweet_text, statusId, null, null, null, null, null, null, null,new Callback<Tweet>() {
@Override
public void success(Result<Tweet> result) {
}
@Override
public void failure(TwitterException e) {
});
If you have any better solution than this, please let me know. Happy Coding and Have a fun…