You can use facebook like button in android app using special permission from facebook developer account https://developers.facebook.com.
Add your app here and submit app special permission.
Go to app review and submit items for approval.
click on start submission and after that select LIKE native button and submit all details they want like why you want get like permission , how your app will use this permission everything.
If Facebook will approve your request then you can use facebook like button inside app.enter code here
<com.facebook.share.widget.LikeView
android:id="@+id/facebooklike"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</com.facebook.share.widget.LikeView>
After this you need to do some java code.
likeView = (LikeView) findViewById(R.id.facebooklike);
likeView.setLikeViewStyle(LikeView.Style.STANDARD);
likeView.setAuxiliaryViewPosition(LikeView.AuxiliaryViewPosition.INLINE);
likeView.setHorizontalAlignment(LikeView.HorizontalAlignment.CENTER);
likeView.setObjectIdAndType("url of like page", LikeView.ObjectType.PAGE);
like functionality automatically call when you click on like button.
now you need to get response from like page that user like that page of unlike that page.
enter code here
public class FbLikes extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fb_likes);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
try {
if (resultCode == RESULT_OK) {
// verify we're returning from like action
// get action results
bundle = data.getExtras().getBundle("com.facebook.platform.protocol.RESULT_ARGS");
if (bundle != null) {
like = bundle.getBoolean("object_is_liked");// liked/unliked
bundle.getInt("didComplete");
bundle.getInt("like_count"); // object like count
bundle.getString("like_count_string");
bundle.getString("social_sentence");
bundle.getString("completionGesture"); // liked/cancel/unliked
Log.e(TAG, bundle.getString("social_sentence") + "");
Log.e(TAG, "likeornot" + bundle.getBoolean("object_is_liked") + "");
Log.e(TAG, "lcomplete" + bundle.getString("completionGesture") + "");
Log.e(TAG, "count" + bundle.getInt("like_count") + "");
Log.e(TAG, "countstr" + bundle.getString("like_count_string") + "");
Log.e(TAG, "did" + bundle.getInt("didComplete") + "");
}
}
} catch (Exception e) {
}
}
}
this code will return everything you want from like functionality.