1. Documents
  2. Android SDK

Getting user profiles

You can use the Android SDK to get a user’s LINE profile information. User profiles include a user’s user ID, display name, profile media (image or video), and status message.

Before you begin

Make sure you have completed the following:

Getting user profile information

To get the user’s LINE profile information, call the getProfile() method. The method returns a LineApiResponse object containing LineProfile. When getProfile() is called, the SDK automatically checks the validity of the access token. If the access token has expired, the SDK will try to refresh the token. If the token cannot be refreshed, an error response is returned and you must prompt the user to log in again.

The following is an example of how to get the user’s profile and save the data into strings.


LineApiResponse verifyResponse = lineApiClient.getProfile();

String displayName = apiResponse.getResponseData().getDisplayName();
String pictureURL = apiResponse.getResponseData().getPictureUrl().toString();
String userID = apiResponse.getResponseData().getUserId().toString();
String statusMessage = apiResponse.getResponseData().getUserId();

Handling errors

The following HTTP response codes and messages are returned when an API is called.

HTTP Status Description
200 OK Request successful
400 Bad Request Problem with the request. Check the request parameters and JSON format.
401 Unauthorized Check that the authorization header is correct.
403 Forbidden Not authorized to use the API. Confirm that your account or plan is authorized to use the API.
429 Too Many Requests Make sure that you are within the rate limits for requests.
500 Internal Server Error Temporary error on the API server.

Related pages

For more information on the Android SDK, see the following pages.