In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail what is the use of ibinder in android. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
IBinder starts the service by binding the service, that is, the service can communicate with the class that initiates service through Binder. IBinder is a communication interface and Binder is a method.
What is IBinder?
First of all, it is important to understand that the remote call (that is, cross-process call) of Android is implemented through IBinder. Here is the translation of the android development document.
IBinder is the basic interface of remote objects and the core of a lightweight remote invocation mechanism designed for high performance. But it is used not only for remote calls, but also for in-process calls. This interface defines the protocol for interacting with remote objects. Instead of implementing this interface directly, you should derive it from Binder.
The main API of IBinder is transact (), and the other method corresponding to it is Binder.onTransact (). The first method allows you to send and make calls to the remote IBinder object, and the second method enables your own remote objects to respond to received calls. The API of IBinder is executed synchronously, for example, transact () does not return until the other party's Binder.onTransact () method call is complete. This is undoubtedly the case when the call occurs within a process, and it has the same effect between processes with the help of IPC.
IBinder source code:
Packageandroid.os
Importandroid.annotation.NonNull
Importandroid.annotation.Nullable
Importjava.io.FileDescriptor
PublicinterfaceIBinder {
/ * *
* Thefirsttransactioncodeavailableforusercommands.
* /
IntFIRST_CALL_TRANSACTION=0x00000001
/ * *
* Thelasttransactioncodeavailableforusercommands.
* /
IntLAST_CALL_TRANSACTION=0x00ffffff
/ * *
* IBinderprotocoltransactioncode:pingBinder ().
* /
IntPING_TRANSACTION= ('_'
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.