Application and configuration instructions for Sina Weibo developer platform

Source: Internet
Author: User

Chapter One FAQ description
In this project microblogging development documents you use Sina Weibo official Weibosdkdemo for everyone to demonstrate the construction of the basic environment of the project, the following development is based on the development, the purpose is to facilitate learning and understanding of the project structure, Sina Weibo certification authorization and Sina Weibo API call.
Weibosdkdemo use of Appkey, Authorized callback address and Debug.keystore are provided by Sina Weibo officer, and Weibosdkdemo package name can not be changed, after you are familiar with the project structure, you can also apply for the developer account on the Sina Weibo open platform, and create their own applications, you do not have to use Sina Weibo officially provided, the creation process can Refer to Chapter II and chapter III.
Precautions in using Weibosdkdemo:
1. The package name (Com.sina.weibo.sdk.demo) used in Weibosdkdemo cannot be changed when using Weibosdkdemo, Appkey is provided in the Constants.java file in the src root directory, Be sure to use this appkey, otherwise it will cause signature authentication failure on the official Sina authorized authentication server. 2. Be sure to use the Debug.keystore provided in the demo
3. The MD5 tool generates signatures based on KeyStore, and the signatures generated by different keystore are not the same. This demo
The signature is generated by the KeyStore provided by the official website, to run the demo program successfully, you need to set up or replace the KeyStore, two methods can choose one of the operations:
Method One: Replace the KeyStore, replace the android default Debug.keystore (in the C:\Users\xxxx\.android directory) with the official Debug.keystore provided on the Hithub.
Method Two: Set up Project KeyStore in Eclipse, click "Windows---Preferences, Android---Build" in Eclipse, at custom debug KeyStore Select the Debug.keystore in the demo, click Apply---Ok,demo to run normally.
4. Weibosdkdemo the entire project using the UTF-8 format encoding, right-click on the project name, tap Properties---Resource, click Other in the right view, select UTF-8 mode.
5. Both the Target SDK and the Minimum SDK are selected for Android 4.0 or higher.
6. Must use Eclipse3.0 or above, JDK1.6 or JDK1.7 (less than 1.6 and 1.8 are not tested) 7. For more information about the refresh wait on the main screen, try restarting Eclipse and virtual machine, and recommend that you

Debug with a real machine.
Chapter II Developer Application
1. Edit the developer's basic information

login Sina Weibo development platform http://open.weibo.com/, click on the" Edit developer Information "under the profile picture and nickname in the top right corner of the webpage, select the developer type for individual, fill in the real personal information, the website can fill in the personal blog , click Submit after completing the completion.

2. Identity authentication  
fill in the identity card information, and upload ID on the front and back clear scan photos, and finally verify the mobile phone number.  
(you can create an app without identity authentication, Just can't submit app audit, API some restrictions, and create the app only 15 test users, need to be in the background settings, the following documents will be described in the document, no authentication is OK, here has little impact on us. )  

Detail API Description: Http://open.t.sina.com.cn/wiki/%E5%BE%AE%E5%8D%9AAPI)

After completing the two steps above, click on my app to display the following information:

Chapter III Creating an app (very important here)

Click "Micro link" on the Weibo open platform navigation bar and click on the mobile app in the dropdown menu to display the following page:

Click Connect now to create a new app:

Click on the Create button to enter the application page by filling in the application name, application category and application platform:


Once you've created your app, you'll be able to see the app's app key and app secret, and see the part of the red box. You will need to fill in the application information, application information in the most critical part of the red box in the section, Android signature package name information, below we explain how to survive Android signature.
1. Generate the Android signature and fill in the basic information

A) Change Debug.keystore

In the weibosdkdemo provided by Sina Weibo, we are using the Debug.keystore provided in Weibosdkdemo, and now we have applied to Appkey, the first step is to change the debug.keystore.
In general, for a company, the company only needs to save two keystore, Debug.keystore and Release.keystore, the former for testing, the latter for publishing.
When we use Eclipse to create an app, The default is to use the debug.keystore provided by eclipse, if you have previously used the official Sina Weibo Debug.keystore, will be deleted, if you are using the Eclipse default Debug.keystore, then you do not need to change.

Click Windows–> perferences, Android---Build, as shown, using the default Debug.keystore, if custom debug KeyStore has something inside, delete custom The contents of the debug KeyStore.

b) Change the Appkey and callback address

Locate the Appkey in the basic information, such as application information, copy the Appkey, locate the Constants.java file in the root directory of the source code, and change the Appkey.

In the application information –> advanced information, complete the authorization callback page and the cancellation authorization callback page:


Fill in Address: https://api.weibo.com/oauth2/default.html

Locate the Constants.java file in the root directory of the source code and change the Redirect_url.
c) generate application signature  

First to download the signature tool App_ SIGNATURES.APK, which can be found in the folder where the document is located, can also be downloaded from the Web.  
:http://pan.baidu.com/s/ 1C051IWS  
If you are using a virtual machine: 

It is best to clear the data from the virtual machine before use, and tick wipe user data when the virtual machine is started.

After the virtual machine starts, run the program first, install the microblog app on the virtual machine, run it at least once, then the program will go wrong, not the tube (make sure that the eclipse default Debug.store, Appkey and Redirect_url are consistent with the information on the developer platform).

Then install APP_SIGNATURES.APK on the virtual machine, you can download app_signatures.apk from the browser in the virtual machine, or manually click the Ddms interface in Eclipse and manually app_ in the file explorer signatures.apk uploaded to the virtual machine.
Then run app_signatures.apk, enter the Android app package name, which is the packages in the Androidmanifest.xml file.

Click the Generate button to generate a string of strings, copy the string to the Android signature in the application information –> basic information on the developer platform, fill in the corresponding Android package name (make sure that the Android package name and the package name in the phone app have been signed correctly)


If you are using real-machine debugging:
If the official Sina Weibo client is installed on the phone, first delete the official Sina Weibo Weibo client on the phone, then delete the client that we are developing, and then restart the phone, install the app on the phone, and run it at least once.
Then install app_signatures.apk, run app_signatures.apk, then run app_signatures.apk, enter the Android app package name, is the package in the Androidmanifest.xml file.
Click the Generate button to generate a string of strings, copy the string to the Android signature in the application information –> basic information on the developer platform, fill in the corresponding Android package name (make sure to ensure that the Android package name and the package name in the phone app have been signed correctly).
To this, we have successfully generated the application signed filled, and then fill in the rest of the basic information, fill out the method can be referenced below.

Then click Save information to submit a review. (As long as the information is saved, even if the audit does not pass, it has no effect.) )

2. Add a Test Account

Applications that have not been audited are only provided with 15 test accounts, click Application Information---test information, and add the Sina Weibo account you used to test.

3. FAQ

1. Auth Exception:sso package or sign error appears
The signature generated by the package name on the phone does not match the signature on the open platform, follow these steps:
1) Check to see if Debug.keystore is using eclipse default Debug.keystore, use eclipse default
The Debug.keystore
2) Check that the application Appkey is correct, the callback address is filled in correctly 3) check the package name is correct
4) If you are using a virtual machine, clear all the data from the virtual machine, re-virtual machine, install the application, execute
Once, fill in the correct package name, regenerate the signature
5) If you are using real machine debugging, first uninstall the official Weibo client on the real machine and the installed Weibo app,
Restart your phone, rerun the program, fill in the correct package name, and regenerate the signature

Application and configuration instructions for Sina Weibo developer platform

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.