romatroskin / social_share_plugin

Social Share to Facebook and Instagram Flutter plugin.
BSD 2-Clause "Simplified" License
41 stars 87 forks source link

share with facebook ,it just open google play store only #53

Closed Matsuo32 closed 2 years ago

Matsuo32 commented 3 years ago

Hello

I have a problem when share with facebook ,it will open google play store only . it's not open facebook app ** for iOS is work not problem.

I already setup as below

android/app/src/main/AndroidManifest.xml

<meta-data android:name="com.facebook.sdk.ApplicationId"
    android:value="@string/facebook_app_id"/>

<meta-data android:name="com.facebook.sdk.ApplicationName"
            android:value="@string/app_name"/>

<activity android:name="com.facebook.FacebookActivity"
    android:configChanges=
            "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:label="@string/app_name" />

<provider android:authorities="com.facebook.app.FacebookContentProviderXXXXXXXXXX"
            android:name="com.facebook.FacebookContentProvider"
            android:exported="true"/>

<provider android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.social.share.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths"/>
        </provider>

android/app/src/main/res/xml/provider_paths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-files-path name="external_files" path="/"/>
    <external-cache-path name="external_cache" path="/"/>
    <external-media-path name="external_media" path="/"/>
    <external-path name="external" path="/"/>
    <cache-path name="cache" path="/"/>
    <files-path name="files" path="/"/>
    <!-- <external-path name="external_files" path="."/> -->
</paths>

android/app/src/main/res/value/string.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">Test app</string>

    <!-- Replace "000000000000" with your Facebook App ID here. -->
    <string name="facebook_app_id">XXXXXXXXX</string>

</resources>
ilyoungkim commented 3 years ago

If it's Android, if you don't have the Facebook app installed, you'll be taken to the Google Play Store page first.

lpancho commented 3 years ago

Any fix on this? I have experienced this as well even I have facebook installed it goes to play store.

ondev commented 3 years ago

I have the same issue. Already install facebook app, when share will open google play store.

ondev commented 3 years ago

this is my flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.5, on Microsoft Windows [Version 10.0.19041.208], locale zh-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[!] Android Studio
    X android-studio-dir = C:\Program
    X Android Studio not found at C:\Program
[√] IntelliJ IDEA Ultimate Edition (version 2020.3)
[√] VS Code, 64-bit edition (version 1.44.2)
[√] Connected device (2 available)
ilyoungkim commented 3 years ago

Me too same issue. shareToFeedFacebookLink call, then share will open google play store. why not?

I/SurfaceView(17121): onWindowVisibilityChanged(4) false io.flutter.embedding.android.FlutterSurfaceView{eea8403 V.E...... ........ 0,0-1080,2265} of ViewRootImpl@b05e614[MainActivity] I/SurfaceControl(17121): assignNativeObject: nativeObject = 0 Surface(name=null)/@0x48e9779 / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1810 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 I/SurfaceControl(17121): assignNativeObject: nativeObject = 0 Surface(name=null)/@0xb654f80 / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1820 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 I/ViewRootImpl@b05e614MainActivity: Relayout returned: old=(0,0,1080,2400) new=(0,0,1080,2400) req=(1080,2400)4 dur=10 res=0x1 s={false 0} ch=false fn=-1 I/ViewRootImpl@b05e614MainActivity: stopped(false) old=true I/ViewRootImpl@b05e614MainActivity: stopped(false) old=false I/SurfaceView(17121): onWindowVisibilityChanged(0) false io.flutter.embedding.android.FlutterSurfaceView{eea8403 V.E...... ........ 0,0-1080,2265} of ViewRootImpl@b05e614[MainActivity] I/SurfaceControl(17121): assignNativeObject: nativeObject = 0 Surface(name=null)/@0xb654f80 / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1820 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 I/ViewRootImpl@b05e614MainActivity: Relayout returned: old=(0,0,1080,2400) new=(0,0,1080,2400) req=(1080,2400)0 dur=18 res=0x7 s={true -5476376650918218080} ch=true fn=-1 I/SurfaceView(17121): windowStopped(false) true io.flutter.embedding.android.FlutterSurfaceView{eea8403 V.E...... ........ 0,0-1080,2265} of ViewRootImpl@b05e614[MainActivity] I/SurfaceView(17121): surfaceCreated 1 #1 io.flutter.embedding.android.FlutterSurfaceView{eea8403 V.E...... ........ 0,0-1080,2265} I/SurfaceView(17121): surfaceChanged (1080,2265) 1 #1 io.flutter.embedding.android.FlutterSurfaceView{eea8403 V.E...... ........ 0,0-1080,2265} I/ViewRootImpl@b05e614MainActivity: [DP] dp(1) 1 android.view.SurfaceView.updateSurface:1311 android.view.SurfaceView.setWindowStopped:343 android.view.SurfaceView.surfaceCreated:1835 I/ViewRootImpl@b05e614MainActivity: [DP] pdf(0) 1 android.view.SurfaceView.notifyDrawFinished:577 android.view.SurfaceView.performDrawFinished:564 android.view.SurfaceView.lambda$TWz4D2u33ZlAmRtgKzbqqDue3iM:0 I/ViewRootImpl@b05e614MainActivity: [DP] rdf() I/ViewRootImpl@b05e614MainActivity: updateBoundsLayer: shouldReparent = true t = android.view.SurfaceControl$Transaction@70b77c9 sc = Surface(name=Bounds for - co.kr.liveshare.liveshare_app/co.kr.liveshare.liveshare_app.MainActivity@4)/@0x8c6f9a5 frame = 1 I/ViewRootImpl@b05e614MainActivity: [DP] dp(1) 1 android.view.ViewRootImpl.reportNextDraw:10957 android.view.ViewRootImpl.performTraversals:3845 android.view.ViewRootImpl.doTraversal:2618 I/ViewRootImpl@b05e614MainActivity: [DP] pd() Asnyc report I/SurfaceView(17121): setParentSpaceRectangle: useBLAST = false position = Rect(0, 0 - 1080, 2265) frameNumber = 1 t = android.view.SurfaceControl$Transaction@95e3b6a I/SurfaceView(17121): applySurfaceTransforms: t = android.view.SurfaceControl$Transaction@95e3b6a surfaceControl = Surface(name=SurfaceView - co.kr.liveshare.liveshare_app/co.kr.liveshare.liveshare_app.MainActivity@eea8403@4)/@0x766c17a frame = 1 I/SurfaceView(17121): applySurfaceTransforms: postScaleX = 1.0 postScaleY = 1.0 I/ViewRootImpl@b05e614MainActivity: [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$performDraw$1$ViewRootImpl:4668 android.view.-$$Lambda$ViewRootImpl$DJd0VUYJgsebcnSohO6h8zc_ONI.run:6 android.os.Handler.handleCallback:938 I/ViewRootImpl@b05e614MainActivity: [DP] rdf() I/ViewRootImpl@b05e614MainActivity: MSG_WINDOW_FOCUS_CHANGED 1 1 D/InputMethodManager(17121): prepareNavigationBarInfo() DecorView@9c8ce8b[MainActivity] D/InputMethodManager(17121): getNavigationBarColor() -855310 D/InputMethodManager(17121): prepareNavigationBarInfo() DecorView@9c8ce8b[MainActivity] D/InputMethodManager(17121): getNavigationBarColor() -855310 V/InputMethodManager(17121): Starting input: tba=co.kr.liveshare.liveshare_app ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false D/InputMethodManager(17121): startInputInner - Id : 0 I/InputMethodManager(17121): startInputInner - mService.startInputOrWindowGainedFocus D/InputTransport(17121): Input channel constructed: 'ClientS', fd=96 I/SurfaceControl(17121): nativeRelease nativeObject s[-5476376655750612752] I/SurfaceControl(17121): nativeRelease nativeObject e[-5476376655750612752] I/SurfaceControl(17121): nativeRelease nativeObject s[-5476376655750437248] I/SurfaceControl(17121): nativeRelease nativeObject e[-5476376655750437248] I/ViewRootImpl@b05e614MainActivity: ViewPostIme pointer 0 I/ViewRootImpl@b05e614MainActivity: ViewPostIme pointer 1 I/ViewRootImpl@b05e614MainActivity: MSG_WINDOW_FOCUS_CHANGED 0 1 I/SurfaceControl(17121): nativeRelease nativeObject s[-5476376655750629104] I/SurfaceControl(17121): nativeRelease nativeObject e[-5476376655750629104] I/SurfaceControl(17121): nativeRelease nativeObject s[-5476376655750520464] I/SurfaceControl(17121): nativeRelease nativeObject e[-5476376655750520464] I/SurfaceControl(17121): nativeRelease nativeObject s[-5476376655750544096] I/SurfaceControl(17121): nativeRelease nativeObject e[-5476376655750544096] I/SurfaceView(17121): onWindowVisibilityChanged(8) false io.flutter.embedding.android.FlutterSurfaceView{eea8403 V.E...... ........ 0,0-1080,2265} of ViewRootImpl@b05e614[MainActivity] I/SurfaceView(17121): surfaceDestroyed callback.size 1 #2 io.flutter.embedding.android.FlutterSurfaceView{eea8403 V.E...... ........ 0,0-1080,2265} W/libEGL (17121): EGLNativeWindowType 0xb400007379eb2bd0 disconnect failed I/SurfaceView(17121): remove() from RT android.view.SurfaceView$2@a456bc3 Surface(name=SurfaceView - co.kr.liveshare.liveshare_app/co.kr.liveshare.liveshare_app.MainActivity@eea8403@4)/@0x766c17a I/SurfaceControl(17121): nativeRelease nativeObject s[-5476376655750421456] I/SurfaceControl(17121): nativeRelease nativeObject e[-5476376655750421456] I/SurfaceControl(17121): nativeRelease nativeObject s[-5476376655750662368] I/SurfaceControl(17121): nativeRelease nativeObject e[-5476376655750662368] W/libEGL (17121): EGLNativeWindowType 0xb400007379c6b6b0 disconnect failed I/SurfaceControl(17121): nativeRelease nativeObject s[-5476376655750582960] I/SurfaceControl(17121): nativeRelease nativeObject e[-5476376655750582960] I/SurfaceControl(17121): assignNativeObject: nativeObject = 0 Surface(name=null)/@0x48e9779 / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1810 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 I/SurfaceControl(17121): assignNativeObject: nativeObject = 0 Surface(name=null)/@0xb654f80 / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1820 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 I/SurfaceControl(17121): nativeRelease nativeObject s[-5476376655750636720] I/SurfaceControl(17121): nativeRelease nativeObject e[-5476376655750636720] I/SurfaceControl(17121): nativeRelease nativeObject s[-5476376655750504672] I/SurfaceControl(17121): nativeRelease nativeObject e[-5476376655750504672] I/ViewRootImpl@b05e614MainActivity: Relayout returned: old=(0,0,1080,2400) new=(0,0,1080,2400) req=(1080,2400)8 dur=4 res=0x5 s={false 0} ch=true fn=2 I/SurfaceView(17121): windowStopped(true) false io.flutter.embedding.android.FlutterSurfaceView{eea8403 V.E...... ........ 0,0-1080,2265} of ViewRootImpl@b05e614[MainActivity] I/ViewRootImpl@b05e614MainActivity: stopped(true) old=false D/InputTransport(17121): Input channel destroyed: 'ClientS', fd=96 I/SurfaceControl(17121): nativeRelease nativeObject s[-5476376655750582960] I/SurfaceControl(17121): nativeRelease nativeObject e[-5476376655750582960]

ilyoungkim commented 3 years ago

Me too same issue. shareToFeedFacebookLink call, then share will open google play store. why not?

ref: https://githubmemory.com/repo/OpenFlutter/flutter_share_me fix it on pixel one but samsung s21 not working.

   <provider android:authorities="com.facebook.app.FacebookContentProvider553322254704658"
       android:name="com.facebook.FacebookContentProvider"
       android:exported="false"/>

why not?

thaibui88 commented 2 years ago

I have same issue with Android. In iOS, if I don't install facebook app, it will open App Store. But after I installed Facebook app, it doesn't do anything when call SocialSharePlugin.shareToFeedFacebookLink. I still setup for iOS Info.plist as below:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <!--
              Replace "000000000000" with your Facebook App ID here.
              **NOTE**: The scheme needs to start with `fb` and then your ID.
            -->
            <string>fb000000000000</string>
        </array>
    </dict>
</array>

<key>FacebookAppID</key>

<!-- Replace "000000000000" with your Facebook App ID here. -->
<string>000000000000</string>
<key>FacebookDisplayName</key>

<!-- Replace "YOUR_APP_NAME" with your Facebook App name. -->
<string>YOUR_APP_NAME</string>

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>instagram</string>
    <string>fbapi</string>
    <string>fb-messenger-share-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
    <string>twitter</string>
</array>

@Matsuo32 could you please share me how you can run OK on iOS?

Does anyone have solution for Android?

romatroskin commented 2 years ago

starting from Android 11 you need to add following to the AndroidManifest.xml

<manifest ...>
    ...
    <queries>
        <package android:name="com.twitter.android" />
        <package android:name="com.facebook.katana" />
        <package android:name="com.com.instagram.android" />
    </queries>
    ...
     <application ...>
    ...
</manifest>