简体   繁体   English

如何实现Facebook共享,然后在Android App中使用深层链接(打开我的应用程序)发布发布的深层链接?

[英]how to implement Facebook sharing and then deep link that post using deep link(open my app) in android App?

I want to implement deep linking for facebook app post. 我想为Facebook应用发布实现深层链接。 Firstly I want to share my App content on Facebook Post and when user tap on the post then if User already has the app installed then open app otherwise It will open app link. 首先,我想在Facebook Post上分享我的App内容,然后当用户点击该Post时,如果用户已经安装了该App,则打开app,否则将打开App链接。

I follow https://developers.facebook.com/docs/applinks/android and https://developers.facebook.com/docs/sharing/android#linkshare but It's not working 我遵循https://developers.facebook.com/docs/applinks/androidhttps://developers.facebook.com/docs/sharing/android#linkshare但它无法正常工作

how to share this data using LinkShare on facebook 如何在Facebook上使用LinkShare共享此数据

target_url: " https://developers.facebook.com/android " extras: fb_app_id: [YOUR_FACEBOOK_APP_ID] fb_access_token: "[ACCESS_TOKEN]" fb_expires_in: 3600 target_url:“ https://developers.facebook.com/android ”额外功能:fb_app_id:[YOUR_FACEBOOK_APP_ID] fb_access_token:“ [ACCESS_TOKEN]” fb_expires_in:3600

To implement deep linking and sharing together, need to implement this feature using branch.io 要一起实现深度链接和共享,需要使用branch.io实现此功能

Add dependency : 添加依赖项:

 compile 'com.google.android.gms:play-services-appindexing:9.+' 

Add this code in the manifest file inside Launcher Activity 将此代码添加到Launcher活动内的清单文件中

  <!-- Branch URI Scheme -->
        <intent-filter>
            <data android:scheme="androidexample" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>

        <!-- Branch App Links (optional) -->
        <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="https" android:host="example.app.link" />
            <data android:scheme="https" android:host="example-alternate.app.link" />
        </intent-filter>    

Add this code to your Launcher Activity, You will get your link and data in this method 将此代码添加到启动器活动中,您将通过此方法获取链接和数据

@Override
public void onStart() {
    super.onStart();

    // Branch init
    Branch.getInstance().initSession(new Branch.BranchReferralInitListener() {
        @Override
        public void onInitFinished(JSONObject referringParams, BranchError error) {
            if (error == null) {
                Log.i("BRANCH SDK", referringParams.toString());
                // Retrieve deeplink keys from 'referringParams' and evaluate the values to determine where to route the user
                // Check '+clicked_branch_link' before deciding whether to use your Branch routing logic
            } else {
                Log.i("BRANCH SDK", error.getMessage());
            }
        }
    }, this.getIntent().getData(), this);
}    

Add this code in MyApplication class 将此代码添加到MyApplication类中

 // Branch logging for debugging
    Branch.enableLogging();

 // Branch object initialization
    Branch.getAutoInstance(this);   

You can create deep link using this code 您可以使用此代码创建深层链接

 LinkProperties lp = new LinkProperties()
.setChannel("facebook")
.setFeature("sharing")
.setCampaign("content 123 launch")
.setStage("new user")
.addControlParameter("$desktop_url", "http://example.com/home")
.addControlParameter("custom", "data")
.addControlParameter("custom_random", 
Long.toString(Calendar.getInstance().getTimeInMillis()));

buo.generateShortUrl(this, lp, new 
Branch.BranchLinkCreateListener() {
@Override
public void onLinkCreate(String url, BranchError error) {
    if (error == null) {
        Log.i("BRANCH SDK", "got my Branch link to share: " + url);
    }
}
});    

refer this for Android 为Android参考

refer this for ios 为iOS参考

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android使用whatsapp共享深层链接网址并在点击深层链接时打开我的应用 - Android share deep link url using whatsapp and open my app when click deep link 使用深层链接打开带有外部链接的应用程序 - Using Deep link to open app with external link 深层链接未从 facebook 帖子打开应用程序 - Deep link is not opening the app from facebook post 通过Android将视频发布到Facebook,并具有指向应用的深层链接 - Post video to Facebook from Android with deep link back to app Android应用程式中的深层连结 - Deep link in android app 如何使Facebook App Ads打开Play商店而不是我的没有深层链接的旧Android应用程序? - How to make Facebook App Ads open Play Store instead of my old Android app which doesn't have deep link? 如何通过单击Facebook上的任何URL打开Android应用(Android的Facebook深层链接) - How to open Android app by clicking any URL on facebook (Facebook deep link for android) 如何深入链接我的Android应用程序到paytm和freecharge应用程序? - How to deep link my android app to paytm and freecharge app? 是否可以在Android上使用URL(深层链接)打开“设置”应用程序? - Is it possible to open Settings App using URL (Deep link) on Android? 如何使用 android 应用链接或深层链接打开应用特定活动? 还有如何为单个应用程序的多个动态链接生成和编码? - How to open app specific activity using android app link or deep link? Also how to generate & code for multiple dynamic links for single app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM