The Custom Property of My Custom Open Graph Object is Not Shown in the Share Dialog

白昼怎懂夜的黑 提交于 2019-12-23 07:29:37

问题


I cannot get the custom properties of my custom Open Graph object displayed in the Share dialog of my Android app. I created a custom object channel in the namespace myradio_android, and defined a custom property current_song_title in channel. I also created a custom action enjoy, but I cannot get the my custom property current_song_title displayed in the Share dialog. What I get can be seen the pasted image below.

Here's the code I am using to create the Share dialog:

    // Facebook
    mImageButtonShareOnFacebook = (ImageButton)view.findViewById(R.id.shareOnFacebook);
    mImageButtonShareOnFacebook.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            FacebookSdk.sdkInitialize(getActivity().getApplicationContext());

            SharePhoto photo = new SharePhoto.Builder()
                    .setBitmap(_albumCover)
                    .setUserGenerated(true)
                    .build();

            // Create an object
            ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
                    .putString("og:type", "myradio_android:channel")
                    .putString("og:title", channel.getName())
                    .putString("og:description", "My description")
                    .putString("myradio_android:channel:current_song_title", _title)
                    .putPhoto("og:image", photo)
                    .build();


            // Create an action
            ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
                    .setActionType("myradio_android:enjoy")
                    .putObject("channel", object)

                    .build();

            // Create the content
            ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
                    .setPreviewPropertyName("channel")
                    .setAction(action)
                    .build();

            ShareDialog.show(NowPlayingFragment.this, content);

        }
    });

Edit: I have attached the Edit Attachments dialog:


回答1:


Instead of myradio_android:channel:current_song_title try myradio_android:current_song_title



来源:https://stackoverflow.com/questions/34020536/the-custom-property-of-my-custom-open-graph-object-is-not-shown-in-the-share-dia

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!