Skip to main content
Version: Next

Viral Social Network Posts

Configure

To send posts with 101XP SDK, you need to add the following lines to AndroidManifest.xml:

<!-- FB posts -->
<meta-data android:name="com.facebook.sdk.fbPostCount" android:value="@integer/com_fb_post_count" />
<meta-data android:name="com.facebook.sdk.fbPost1.Text" android:value="@string/com_fb_post1_text" />
<meta-data android:name="com.facebook.sdk.fbPost1.Url" android:value="@string/com_fb_post1_url" />
<meta-data android:name="com.facebook.sdk.fbPost1.Img" android:value="@string/com_fb_post1_img" />

<!-- VK posts -->
<meta-data android:name="com.vk.sdk.vkPostCount" android:value="@integer/com_vk_post_count" />
<meta-data android:name="com.vk.sdk.vkPost1.Text" android:value="@string/com_vk_post1_text" />
<meta-data android:name="com.vk.sdk.vkPost1.Url" android:value="@string/com_vk_post1_url" />
<meta-data android:name="com.vk.sdk.vkPost1.Img" android:value="@string/com_vk_post1_img" />
<meta-data android:name="com.vk.sdk.vkPost2.Text" android:value="@string/com_vk_post2_text" />
<meta-data android:name="com.vk.sdk.vkPost2.Url" android:value="@string/com_vk_post2_url" />
<meta-data android:name="com.vk.sdk.vkPost2.Img" android:value="@string/com_vk_post2_img" />
<meta-data android:name="com.vk.sdk.vkPost3.Text" android:value="@string/com_vk_post3_text" />
<meta-data android:name="com.vk.sdk.vkPost3.Url" android:value="@string/com_vk_post3_url" />
<meta-data android:name="com.vk.sdk.vkPost3.Img" android:value="@string/com_vk_post3_img" />

<!-- OK posts -->
<meta-data android:name="ru.ok.sdk.okPostCount" android:value="@integer/ru_ok_post_count" />
<meta-data android:name="ru.ok.sdk.okPost1.Text" android:value="@string/ru_ok_post1_text" />
<meta-data android:name="ru.ok.sdk.okPost1.Url" android:value="@string/ru_ok_post1_url" />
<meta-data android:name="ru.ok.sdk.okPost1.Img" android:value="@string/ru_ok_post1_img" />
caution

Vkontakte needs additional permissions for sending posts.

Add the following metadata to AndroidManifest.xml:

<meta-data android:name="com.platform101xp.sdk.sn_extra_permission"
android:value="true"/>

Facebook Posts

info
In your manifest
<provider android:authorities="com.facebook.app.FacebookContentProvider*APP_ID*"
android:name="com.facebook.FacebookContentProvider"
android:exported="true"/>

android:exported="true"/> - very important for send PhotoPost

Facebook work logic. Facebook posts are made only with a picture or with a link and a description (it is possible without a description). The algorithm is as follows:

  • If a link is specified in com.facebook.sdk.fbPost[index].Img (url to image), then a dialog box for sharing this image will open.
  • If com.facebook.sdk.fbPost[index].Img == "" then it checks if there is a link in com.facebook.sdk.fbPost1.Url then a window will open to share the link. if there is com.facebook.sdk.fbPost[index].Text then a description will be added to the link.

Usage

To send a post from your application, use the following function to send a post by id, the post will go to the social network in which the user is currently authorized.

// Java
Platform101XP.sendSocialPost(id);

// Kotlin
Platform101XP.sendSocialPost(id)
info

Where id is a post id (id >= 0 and id < PostCount)