English version for ShareSDK

跳转至: 导航搜索

Share assembly (Share SDK) is an assembly provided for iOS, Android, WP8 APPs, developer just need 10 minutes to assemble it into their own APP. It can not only help developers easily achieved in Renren networks of social sharing, login, attention, access to user data, access friends lists and other mainstream social functions, as well as a powerful statistical analysis and management of social background. You can have understanding of users, information flow, return rates, and data transmission efficiency, effectively guide the daily operations of the mobile APP and promotion, as well as introducing more social APP traffic. Chatting is the strategy of Renren’s next step, open platform will provide assembly to share contents in third party mobile app to Renren client, and display in user chat and group chat box.

目录

Share assembly instructions

1. Download and import Renren network SDK2.0.

Android platform: Download sdk and demo

iOS platform: Download sdk and demo

2. Refer to English version for iOS ShareSDK and English version for Android SharingSDK to finish the development.

Note: Third parties can also do the secondary development to the SDK according to their own needs.

Android Share SDK

Introduction

Renren SharingSDK is a simple package for Renren sharing function, which contains “share to talk” and “share to Renren” two parts. (Concept version support only)

Install

Import the SDK into your project: Copy jar package (RennShareComponent_Android.jar) to the project libs directory (If there isn’t you can create), Right-click the jar file, select "Build path" -----> "Add to Build Path", As shown:

安卓分享组件1.jpg

Instructions for use

Initialization RennShareComponent:

shareComponent = RennShareComponent.getInstance(this); // Get instance

shareComponent.init(APP_ID, API_KEY, SECRET_KEY); // Set Application Information

handle the message sending results by listening to RennShareComponent:

shareComponent.setSendMessageListener(new SendMessageListener() {

@Override

public void onSendMessageSuccess(String messageKey, Bundle bundle){ // TODO Auto-generated method stub } @Override public void onSendMessageFailed(String messageKey, ShareMessageError e) { // TODO Auto-generated method stub } @Override public void onSendMessageCanceled(String messageKey) { // TODO Auto-generated method stub } });

Share news, use sharing a photo-text message for example:

RennImgTextMessage message = new RennImgTextMessage();

Bitmap m = null;

m=BitmapFactory.decodeResource(getResources(),R.drawable.test);

message.setThumbData(m); // Set thumbnail information

message.setUrl(“http://fmn.rrfmn.com/fmn060/20131027/1505/large_IY1N_4dd300008b03118c.jpg”); // Set hoplinks

message.setDescription(“Test pattern description”); // Set the message description

message.setTitle(“Test pattern title”); // Set the message title

message.setMessageKey(“123456”); // Set message’s unique identification

shareComponent.setSendMessageListener(new SendMessageListener() { @Override

public void onSendMessageSuccess(String messageKey, Bundle bundle){ // TODO Auto-generated method stub } @Override

public void onSendMessageFailed(String messageKey, ShareMessageError e) { // TODO Auto-generated method stub } @Override

public void onSendMessageCanceled(String messageKey) { // TODO Auto-generated method stub } });

shareComponent.sendMessage(message, MessageTarget.TO_TALK); // Message sent m.recycle();


Sharing information list

RennTextMessage plain text sharing information parameter:

Name Type Required Description
messageKey String false Unique identifications for different messages
title String false Text title
text String true Text content
url String false Hoplinks

RennImageMessage Plain picture sharing information parameter:

Name Type Required Description
messageKey String false Unique identifications for different messages
title String false Text title
imageUrl String false Network Link
localPath String false Native map path
thumbData Bitmap true Thumbnail Data

Note: imageUrl and localPath are picture message for thumbnails clicked to zoom; the two fields cannot be empty in the same time by default, when the two fields exist simultaneously take localPath for processing.

RennImgTextMessage Plain picture sharing information parameter:

Name Type Required Description
messageKey String false Unique identifications for different messages
url String true Hoplinks
title String false Text title
description String false Content Description
thumbData Bitmap false Thumbnail Data

Note: title、description and thumbData cannot be empty in the same time.

Error code of sharing message

ShareMessageErrorSharing message is error:

code(int Type) Message(String Type)
1000 Renren client does not exist or is not supported by the existing version, please download the latest client
1001 rennShareComponent instance is not initialized appId,apiKey,secretKey
1002 Renren client fails to send messages
1010 Plain text message text field cannot be empty
1020 Plain picture information thumbBmp field cannot be empty
1021 Plain picture information localPath field with imageUrl field cannot be empty all
1022 Plain picture information localPath field file does not exist
1030 Photo-text information thumbBmp, text, title field cannot be empty in the same time
1031 Photo-text information url field cannot be empty
1032 Thumbnail size exceeds the boundaries

Material Pictures

ICON-48-ios.png ICON-96-ios.png

iOS Share SDK

Install

Create your project in XCode. Add libShareComponent.a, RennShareComponent.h two files contained in The SDK folder to the project you are building, as shown below:

Ios使用说明1.png

In your project file, select Build Setting, in the Search Paths add libShareComponent.a, RennShareComponent.hg. The location of the two files as shown below. Ios使用说明2.png In Xcode, select your project setting item, select the "TARGETS" column in the "info" tab bar "URL type" add "URL scheme" as the application id you are registering (as shown below) Ios使用说明3.png URL Schemes value should be renrenshare [AppId] [bundleId], [AppId] is registered AppId you got from Renren platform, [bundleId] is currently application’s bundleId.


When you need to use Renren ShareSDK, import RennShareComponent.h. Then initialize Renren share assembly: Ios使用说明4.png Example: Share a graphic message Ios使用说明5.png Till now, you are able to use Renren’s ShareSDK More detailed examples, please see download sdk and demo.

Sharing information list

RennTextMessage plain text sharing information parameter:

Name Type Required Description
messageKey String false Unique identifications for different messages
title String false Text title
text String true Text content
url String false Hoplinks

RennImageMessage Plain picture sharing information parameter:

Name Type Required Description
messageKey String false Unique identifications for different messages
title String false Text title
imageUrl String false Network Link
localPath String false Native map path
thumbData Bitmap true Thumbnail Data

Note: imageUrl and localPath are picture message for thumbnails clicked to zoom; the two fields cannot be empty in the same time by default, when the two fields exist simultaneously take localPath for processing.

RennImgTextMessage Plain picture sharing information parameter:

Name Type Required Description
messageKey String false Unique identifications for different messages
url String true Hoplinks
title String false Text title
description String false Content Description
thumbData Bitmap false Thumbnail Data

Note: title、description and thumbData cannot be empty in the same time.

Error code of sharing message

ShareMessageErrorSharing message is error:

code(int Type) Message(String Type)
1000 Renren client does not exist or is not supported by the existing version, please download the latest client
1001 rennShareComponent instance is not initialized appId,apiKey,secretKey
1002 Renren client fails to send messages
1010 Plain text message text field cannot be empty
1020 Plain picture information thumbBmp field cannot be empty
1021 Plain picture information localPath field with imageUrl field cannot be empty all
1022 Plain picture information localPath field file does not exist
1030 Photo-text information thumbBmp, text, title field cannot be empty in the same time
1031 Photo-text information url field cannot be empty
1032 Thumbnail size exceeds the boundaries

Material Pictures

ICON-57-ios.png ICON-114-ios.png ICON-120-ios.png