#4 Daily issues in android- Twitter asterisk issue in a status update

Issue:

Arun Pandian M
1 min readMar 4, 2019

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 object
StatusesService 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…

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Arun Pandian M
Arun Pandian M

Written by Arun Pandian M

Senior Android developer at FundsIndia, A time investor to learn new things about Programming. Currently in a relationship with Green Bug(Android).

No responses yet

Write a response