[Slide sharing] data communication between PC and Android devices | sun Qiao, popods lab | Android devcamp

Source: Internet
Author: User

Android data sharing technology implementation: data communication between PCs and Android devices | Android devcamp

Topic Introduction: as mobile applications are increasingly dependent on servers, developers' demand for data communication protocols is growing. However, different software versions and network environments may cause many problems between devices from discovery to transmission. The PMP protocol self-developed by pods and protobuf are used to solve communication problems between mobile phones and mobile phones, as well as between mobile phones and PCs. In this speech, Sun Qiao, a founding member of the petabyte lab team, will take the management of mobile phones and the sharing function between mobile phones as an example, it helps you understand how pods efficiently solve communication problems between multiple devices.

Instructor Introduction: a member of the startup team of pods, who specializes in Android development, is currently responsible for researching and practicing the data sharing Function of pods Based on Android clients.

Recommendation index: 3 stars and a half

Recommended reason: The Explanation of data communication protocols is meticulous and valuable. The speech is fluent.

Disadvantages: I'm not talking much about it.

Field score: 3.6

[Lecturer's on-site photo]

[Online slide viewing ]*:

Discover and establish data communication between multiple devices | sun Qiao, popods LaboratoryFrom Shining @ devcamp

Note: * miss Hyun's preference for the slideshare platform allows her to upload and share images only with her tips, but Miss Hyun insisted on choosing a powerful, concise, and easy-to-use platform. I would like to pay tribute to foreign teams that have developed excellent tools and platforms for the benefit of the Internet and humanity, and I would like to express my position on domestic restrictions on these excellent tools and platforms. If you cannot browse normally, you need to use tips like Hyun's sister. For those who still don't know what Hyun's sister talking about, you can move to here.Find a solution.


[Slide download page]: http://download.csdn.net/detail/shiningxyy/4473615-from csdn download channel (do not need points, free download)

[Slide content is coming soon ]:

1. androiddevcampproduced by csdn
2. Data communication between PC and Android devices sun Qiao, founding team member of pods
3. Mobile phone management tasks of pods: simple and easy-to-use Android mobile phone management software. more than 5000 Android mobile phones are managed. The phone Management Protocol (PMP) protocol used by Apple pods includes Google protocol buffers protocol content.
4. Google protocol buffers evaluate protocol buffers are a way of encoding structured data in an efficient yet extensible format. Google uses protocol buffers for almost all of its internal RPC protocols and file formats.
5. google protocol buffersexample. protomessage person {required string name = 1; required int32 id = 2; Optional string email = 3; Enum phonetype {mobile = 0; home = 1; Work = 2 ;}; message phonenumber {required string number = 1; optional phonetype type = 2 [default = Home] ;}; repeated phonenumber phone = 4 ;}
6. google protocol buffers evaluate serialize public byte [] serialization () {exampleproto. person. builder examplebuilder = exampleproto. person. newbuilder (); examplebuilder. setid (1); examplebuilder. setname ("sunqiao"); examplebuilder. setemail ("sunqiao@wandoujia.com"); examplebuilder. addphone (phonenumber. newbuilder (). settype (phonetype. work ). setnumber ("1861817 ****"). build (); Return examplebuilder. build (). tobytearray ();}
7. google protocol buffers evaluate deserialization of Public exampleproto. person deserialization (byte [] personinbytes) {exampleproto. person = NULL; try {person = exampleproto. person. parsefrom (personinbytes);} catch (invalidprotocolbufferexception e) {e. printstacktrace ();} return person ;}
8. Google protocol buffers evaluate serialization time
9. Google protocol buffers evaluate deserialization time
10. Google protocol buffers evaluate the data size after serialization
11. google protocol buffers-memory usage-tobytearray () Public byte [] tobytearray () {try {final byte [] result = new byte [getserializedsize ()]; final codedoutputstream output = codedoutputstream. newinstance (result); writeto (output); output. checknospaceleft (); return result;} catch (ioexception e) {Throw new runtimeexception ("serializing to a byte array threw an ioexception" + "(shocould never happen ). ", e );}}
12. google protocol buffers-memory usage-nested message parent {optional string content_type = 1; optional bytes content = 2 ;}; message Child1 {optional int32 id = 1; optional string name = 2; Optional string des = 3 ;}; message child2 {optional String title = 1; optional string content = 2; Optional bytes icon = 3 ;};
13. Google protocol buffers evaluate the Runtime Library size? optimize_for faster than speed when code_size when using lite_runtime
14. google protocol buffers evaluate Runtime Library size feature protobuf (Lite-runtime) protobuf-j2meRuntime library size 420kb 77kb 22 kbgenerated code 100% 73% 26% sizeenumerations yes yesunknown fields yes noimmutability yes nogroups yes noreflection Yes No nodescriptors Yes No
15. phone Management Protocol ○ authentication Message format: Transport authentication request n Authentication Header n authentication token, used to identify the request, and the token contains security authentication information n authentication service Uri, service address, PMP: // contact/getcontacts n accept client, the client that initiates the request n accept content-range, the request data range n accept body n accept parameters, and the parameter is a key-Value Pair
16. phone Management Protocol ○ Response Message format: Response response n response header n response token, used to identify the response n response Content-Type of a request, used to identify the data type n Bytes Content-Length in the body, used to identify the data length n Bytes content-range in the body, used to identify the range of data contained in the body in the entire request result n   statuscode, similar to the HTTP 1.1 statuscode n   body
17. phone Management Protocol evaluate Content-Type encode rules are similar to mimetype. A string corresponds to a type defined by protobuf and serves as the PMP type system vnd. PMP. item/INT-> baseproto. int vnd. PMP. DIR/INT-> baseproto. ints
18. phone Management Protocol ○ invalid service URI used when service address, for example, PMP: // SMS/receive "listener currently there are four types of services: zookeeper common service zookeeper supports the content-range service zookeeper supports partial-return service zookeeper supports keep-alive service
19. phone Management Protocol evaluate common service respo n head se er token T: reques Conte 12345 ** R heade 2345 *** vnd. p nt-type: * 1 MP token: PMP: // SMS/Conte. item/INT: N ser vice unt statu T-length: 1 SCO getsm da_pc_xxx x body scode: 20 0 client: 1 (PR otobu body f Seri Alize D)
20. phone Management Protocol ○ supports the content-range service respo n head se er treques token: R heade 2345 *** Conte 12345 *** 1 token: PMP: // file/W rite vnd. p nt-type: * MP: ser vice _ pc_xxxx/1400 Conte. item/INT n da client: range: 0-10 23 statu T-length: 4 conten t-body scode: 20 tr> 0 B ody. PMP. item/s Yte> 1024 (prot <PA th, VND. PMP. DIR/B obuf T, VND seria <conten lized)
21. phone Management Protocol ○ support for partial-return services respo n head se er token: T Conte 12345 ** reques app NT-type: V * r nd. PM heade 2345 *** Conte p. DIR/1 List token: PMP: // APP/statu NT-Le N: ser vice _ pc_xxxx SCOD weight: 10204 Conte E: 2 client: da NT-ra 06x30 int> body Nge: body. PM p. item/0-9/y PE, VND apps 300 <APPT (prot obuf seria lized Conte) NT-ty Conte pe nt-Le: VND. PMP statu n. DIR/I body SCOD failed: 4 nT E: 200 body 300 (prot obuf seria lized
22. phone Management Protocol ○ supports the keep-alive service respo n head se er token: Conte 12345 ** reques t notifi NT-type: V * r cat nd. PM heade 2345 *** ait Conte ion p. DIR/1 C ation/w nt-Le token: PMP: // notifi statu N: SCOD failed: 1024 ser vice _ pc_xxxx Conte E: 2 da NT-ra 06 x TTL client: Body Nge: NT> 0-1/body. PMP. item/I notifi effeco TTL <TTL, VND N (PRO tobuf seria Conte .. conte nt-type: v n statu T-length: 4 D. PMP. dir body scode: 20/INT 0 TTL (P rotob UF se rializ ed
23. phone Management Protocol ○ secure token uses the token to verify whether the request is illegal. The token contains the Security Information (which must be accessed by a client authorized by the mobile phone). The specific algorithm is unknown.
24. phone Management Protocol ¨   ¤ n-grams modification method interface definition n-grams modification data structure definition n-grams modification security authentication method n-grams performance optimization, the new serialization/deserialization method is used. The Zookeeper solution N. does not modify or delete the existing method. Only the new method N. does not modify or delete the existing data structure field, only new fields are added. There is only one security authentication method. N queues only use protobuf for serialization and deserialization.
25. Q &

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.