this thread is It's a bigger trick! Bmob-based Android Instant Messaging application source (a) sequel, mainly updated functionality.
One, update more can:
1, added support strangers chat, allow to send to non-friend users;
2, new support custom message sending, easy for developers to expand;
3, the new version greatly increase the stability and timeliness, to ensure that hundreds of arrival;
4. Exclude the impact of Web backend push on the client side.
Second, update the explanation:
1. If you want to be able to chat with everyone (not limited to friendship) , then this version solves the problem.
If you want to see the effect, you can click on the person nearby, you find a non-friend user, then view his profile, there is a "initiation session" button below this page, here can chat with strangers. (Don't ask me, why do I search for people nearby who have no data?) You have a new key, not even registered users, how can people near the show? )
2, if you want to send a message in any format , then you just need to call the following methods:
Bmobchatmanager.getinstance (This). Sendjsonmessage (String json, string targetid);
Note: The first parameter: The JSON-formatted string you want to send, the second argument is the Objectid
However, the JSON format for sending follows certain specifications, which can be viewed in detail:.
Then you need to parse the message in your own format in Mymessagereceiver's broadcast receiver.
3, V1.1.2 version greatly enhance the timeliness and stability, can guarantee the arrival rate.
Because the push service sometimes appears the message loses the situation, and cannot guarantee that the message must be received by the other party, so on this basis added a time detection service, the timing can be set by the developer.
If you need to turn on the timing detection service , you need to invoke the following method in the OnCreate method of the main program interface:
Bmobchat.getinstance (This). Startpollservice (30)
The following method is then called in the Ondestory method to cancel the detection service :
Bmobchat.getinstance (This). Stoppollservice ()
In addition, you need to add the following code to your Androidmanifest.xml
<!--start the timing detection operation--
<service android:name= "Cn.bmob.im.poll.BmobPollService" >
<intent-filter>
<action android:name= "Cn.bmob.im.service.BmobPollService"/>
</intent-filter>
</service>
4, some students do not have two real machine, will push the message from the Web background to the client, the previous version will make the client burst, this version of the elimination of back-end push the impact on the client.
Third, the use of bmob_im_sdk need to pay attention to the following issues:
1, please use two real machine test, please do not use Simulator to test, simulator is not receive push message.
2, a lot of people because there is no two real machine, will use a mobile phone to register two different accounts, this way to switch accounts to test chat, this method does not reach the effect of testing, although this version of the improvements so that the way to receive messages, but the timeliness is relatively low. And the previous version, this way is not receiving messages, it is not recommended to test this, only two of the real machine to achieve real chat results.
3, please go to bmob official website registration application of the application ID and in the Splashactivity class to complete the initialization operation.
4, a lot of people have imported the project found this error:java.lang.IncompatibleClassChangeError:cn.bmob.im.project, this is because bmobim_ V1.1.2 is packaged based on bmobsdk_v3.2.3_0919 obfuscation, so if you want to use them, the two packages should be in-place, replacing the previous bmobsdk and Bmobim packages.
SOURCE here
Link: Http://pan.baidu.com/s/1c0CUcVI Password: CTUC
It's a bigger trick! Android Instant Messaging application source based on Bmob [upgrade version]