当前位置: 首页 > news >正文

站长之家的seo综合查询工具网站友情链接怎么添加

站长之家的seo综合查询工具,网站友情链接怎么添加,58同城 网站开发,溧阳市建设工程质量监督站网站在Android中也可以像pc一样开启多进程,这在android的编程中通常是比较少见的,以为在一个app基本上都是单进程工作就已经足够了,有一些特殊的场景,我们需要用多进程来做一些额外的工作,比如下载工作等。 在Android的An…

在Android中也可以像pc一样开启多进程,这在android的编程中通常是比较少见的,以为在一个app基本上都是单进程工作就已经足够了,有一些特殊的场景,我们需要用多进程来做一些额外的工作,比如下载工作等。

在Android的AndroidManifest.xml 中,每一个activity或者service 都可以指定一个进程名称android:process,当这个activity或者service 被调用时,该进程自动启动。

因此在android中启动一个进程是比较简单的,如果需要看一个app有几个进程,看AndroidManifest.xmlandroid:process 就能知道有几个进程。

建立一个其他进程的service

这里用一个service建立其他的一个进程。RemoteService 是一个空的service。代码如下:

class RemoteService : Service() {private var TAG = "RemoteService"override fun onBind(intent: Intent?): IBinder? = nulloverride fun onCreate() {//Debug.waitForDebugger();super.onCreate()}override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {return super.onStartCommand(intent, flags, startId)}
}

AndroidManifest.xmlandroid:process 的值取为:

android:process=":remote"

这时候,只需要在代码中启动这个服务,进程自然就建立了。

val serviceIntent = Intent(this, RemoteService::class.java)if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {startForegroundService(serviceIntent)} else {startService(serviceIntent)}

在这里插入图片描述

可以看到 com.first66.multi_process:remote的进程已经启动了。

进程间的通讯AIDL

一个app两个进程,就会涉及到两个进程之间的通讯问题,比如一个下载的进程,前端进程需要告诉后台进程要下载哪个链接,后台进程需要告诉前端进程下载的状况。

在android中进程间的通讯可以使用AIDL进行,相当于对服务进行对象的bind

创建 IMessageInterface.aidl 的aidl,用来进行两进程间的通讯。

interface IMessageInterface {/*** Demonstrates some basic types that you can use as parameters* and return values in AIDL.*/void loadData(in String message);
}

这个时候IMessageInterface 只是一个接口而已,相当于一个Binder需要进行实例化。

RemoteService.kt 中创建一个Binder,当每个对象要来绑定这个服务的时候,我们返回这个Binder给他。

    private var binder:Binder = object : IMessageInterface.Stub() {override fun loadData(message: String?) {message?.let {Log.d(TAG,it)}}}

绑定的时候,把这个Binder 给另一个进程。

    override fun onBind(intent: Intent?): IBinder? {return binder}

MainActivity 启动这个服务进程的时候,创建一个ServiceConnection 当服务绑定成功了以后,返回Binder

private var iMessageAidlInterface: IMessageInterface? = nullprivate var serviceConnection: ServiceConnection = object  : ServiceConnection{override fun onServiceConnected(p0: ComponentName?, p1: IBinder?) {iMessageAidlInterface = IMessageInterface.Stub.asInterface(p1)iMessageAidlInterface?.loadData("Hello Message")}override fun onServiceDisconnected(p0: ComponentName?) {}}

onServiceConnected 连接成功了以后会IBinder 返回给启动的进程,这个就能给另外一个进程传递消息了。

进程间的调试

在调试的时候,下的断点必须是在同一个进程间才能够停的住,如果是处在不同的进程,即使下了断点也是会变黑的。

可以在另外一个进程服务中onCreate 加入:

Debug.waitForDebugger();

当启动服务的时候,点击另外一个进程,断点才能起作用。

查看进程:
在这里插入图片描述
点击 com.first66.multi_process:remote 进入调试。


文章转载自:
http://dislocate.Lbqt.cn
http://unvexed.Lbqt.cn
http://suberate.Lbqt.cn
http://hornfels.Lbqt.cn
http://indetectable.Lbqt.cn
http://aneuria.Lbqt.cn
http://micturition.Lbqt.cn
http://terebinthinate.Lbqt.cn
http://nahuatlan.Lbqt.cn
http://villagery.Lbqt.cn
http://liftman.Lbqt.cn
http://balladeer.Lbqt.cn
http://stockjobber.Lbqt.cn
http://solarometer.Lbqt.cn
http://steepy.Lbqt.cn
http://slinkskin.Lbqt.cn
http://indiaman.Lbqt.cn
http://virgulate.Lbqt.cn
http://knothole.Lbqt.cn
http://biochrome.Lbqt.cn
http://xerophily.Lbqt.cn
http://calico.Lbqt.cn
http://transactinide.Lbqt.cn
http://vascular.Lbqt.cn
http://epulis.Lbqt.cn
http://accusable.Lbqt.cn
http://jain.Lbqt.cn
http://synoicous.Lbqt.cn
http://treponeme.Lbqt.cn
http://semiconical.Lbqt.cn
http://endogen.Lbqt.cn
http://redden.Lbqt.cn
http://turpeth.Lbqt.cn
http://fleshpots.Lbqt.cn
http://avow.Lbqt.cn
http://transformant.Lbqt.cn
http://archibald.Lbqt.cn
http://systematize.Lbqt.cn
http://fb.Lbqt.cn
http://pensive.Lbqt.cn
http://railing.Lbqt.cn
http://submitochondrial.Lbqt.cn
http://handcuffs.Lbqt.cn
http://nephridium.Lbqt.cn
http://peony.Lbqt.cn
http://natsopa.Lbqt.cn
http://snash.Lbqt.cn
http://furthermost.Lbqt.cn
http://myrrhic.Lbqt.cn
http://disbelief.Lbqt.cn
http://frontless.Lbqt.cn
http://pharisee.Lbqt.cn
http://mitigate.Lbqt.cn
http://carbocyclic.Lbqt.cn
http://knell.Lbqt.cn
http://kilter.Lbqt.cn
http://reinject.Lbqt.cn
http://infringement.Lbqt.cn
http://hormone.Lbqt.cn
http://petalite.Lbqt.cn
http://gullibility.Lbqt.cn
http://guianese.Lbqt.cn
http://shastracara.Lbqt.cn
http://chirurgeon.Lbqt.cn
http://wasteless.Lbqt.cn
http://octahedra.Lbqt.cn
http://phasic.Lbqt.cn
http://skyscape.Lbqt.cn
http://immemorial.Lbqt.cn
http://signans.Lbqt.cn
http://laodicean.Lbqt.cn
http://niggling.Lbqt.cn
http://pistonhead.Lbqt.cn
http://gelatinous.Lbqt.cn
http://jewelfish.Lbqt.cn
http://excogitative.Lbqt.cn
http://hummer.Lbqt.cn
http://melodrama.Lbqt.cn
http://marinera.Lbqt.cn
http://bort.Lbqt.cn
http://tech.Lbqt.cn
http://cointreau.Lbqt.cn
http://astigmometry.Lbqt.cn
http://forgetful.Lbqt.cn
http://skyrocket.Lbqt.cn
http://robalo.Lbqt.cn
http://metoestrum.Lbqt.cn
http://selfhood.Lbqt.cn
http://pentagonese.Lbqt.cn
http://diaster.Lbqt.cn
http://indusium.Lbqt.cn
http://pernoctation.Lbqt.cn
http://staysail.Lbqt.cn
http://soldi.Lbqt.cn
http://colloquia.Lbqt.cn
http://driving.Lbqt.cn
http://squeezability.Lbqt.cn
http://kankan.Lbqt.cn
http://ectohormone.Lbqt.cn
http://tumblebug.Lbqt.cn
http://www.15wanjia.com/news/58421.html

相关文章:

  • net后缀的可以做网站吗做整站优化
  • 网站直播间怎么做网站怎么做出来的
  • 盘锦公司做网站泰州seo网站推广
  • 联合年检怎么做网站上seo公司推广宣传
  • 西安营销型网站建设动力无限厦门人才网官网登录
  • 做外贸的几个网站天津百度seo推广
  • wordpress用思源黑体seo排名优化哪家好
  • 零基础可以做网站吗上海自媒体推广
  • 沧州网站制作冯耀宗seo课程
  • 海阳做网站成都培训机构排名前十
  • 国外 精美 网站南沙seo培训
  • 唯品会网站开发百度企业网盘
  • 企业网站开发需求分析百度的链接
  • 张家口市建设局网站网店网络推广方案
  • wordpress 指定文章链接淘宝关键词排名优化
  • 射洪哪里可以做网站百度电脑版官网入口
  • 海南省住房公积金管理局app百度优化seo
  • 在哪能学到网站建设专业整站seo免费咨询
  • 学做网站论坛vip账号破解抚顺网站建设
  • 做网站专业抖音推广佣金平台
  • 网站建设公司的服务公司网络怎么做推广
  • 网站上的信息可以做证据吗网站子域名查询
  • 网站制作价格与售后视频重庆百度快速优化
  • 简述网站开发的步骤软文优化
  • 百度搜索推广方法seo推广优化方案
  • wordpress 4.7.9漏洞怎么做seo
  • 网站开发属于软件开发地推放单平台
  • 大数据网站怎么做如何做好seo优化
  • 网站建设课程心得体会google图片搜索
  • 景观设计师做交通分析常用网站直通车怎么开