i want to open Facebook app inside my application and it will show on Imageview On click event. i have referred 10-20 links tried all of them but nothing works for me. i don want to use Facebook default image button, i want to do it on imageview click event.
i have tried links:
- https://developers.facebook.com/docs/android/getting-started
- Android How to Open Facebook App?
- How to open my facebook page in facebook app from button click of an android app
- How to open Facebook app on user timeline?
- Android open facebook page link in facebook app if installed ,
- Open Facebook page from Android app?
and many more
After trying everything my current code is:
public void shareFacebook() {
String fullUrl = "https://m.facebook.com";
try {
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setPackage ("com.facebook.katana");
sharingIntent.putExtra(Intent.EXTRA_TEXT, "your title text");
context.startActivity(sharingIntent);
} catch (Exception e) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(fullUrl));
context.startActivity(i);
}
}
Manifest.xml
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="1975812626048291"/>
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider1975812626048291"
android:exported="true" />
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
<activity android:theme="@style/AppTheme" android:name="com.facebook.katana.FacebookLoginActivity"
android:permission="com.facebook.permission.prod.FB_APP_COMMUNICATION" android:exported="false"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:windowSoftInputMode="stateHidden|adjustResize" />
Dependencies
implementation 'com.facebook.android:facebook-login:4.33.0'
showing version should be same as recycler view version but putting the same version it is still not working.
jcenter()
mavenCentral()
maven { url 'https://jitpack.io'}
describe proper way to implement and also i have put that imageview on recyclerview so please whatever u suggest it should be on onBindViewHolder() of recyclerview.
and current error is:
Unable to find explicit activity class
{com.facebook.katana/com.facebook.katana.ShareLinkActivity}; have you declared this activity in your AndroidManifest.xml?
i dont know how to describe activity of facebook in manifest .. and do we need another java activity just to open app inside our application?