我是靠谱客的博主 秀丽手链,最近开发中收集的这篇文章主要介绍android service中intentfilter,Android bind service with intent filter,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

I have two separate applications and ideally I would like to use an IntentFilter to bind to the service on the second application. Is this possible?

In app 1 Manifest:

android:name=".ServiceName"

android:exported="true"

android:icon="@drawable/ic_launcher"

android:label="Bound Service" >

In app 2 Activity:

It is currently :

@Override

protected void onResume() {

super.onResume();

Intent i = new Intent();

i.setComponent(new ComponentName("com.test.application1", "com.test.application1.ServiceName"));

bindService(i, mConnection, Context.BIND_AUTO_CREATE);

}

Is it possible to work like this :

@Override

protected void onResume() {

super.onResume();

IntentFilter filter1 = new IntentFilter("IntentFilterName");

bindService(filter1, mConnection, Context.BIND_AUTO_CREATE);

}

I get the following error:

The method bindService(Intent, ServiceConnection, int) in the type ContextWrapper is not applicable for the arguments (IntentFilter, ServiceConnection, int)

最后

以上就是秀丽手链为你收集整理的android service中intentfilter,Android bind service with intent filter的全部内容,希望文章能够帮你解决android service中intentfilter,Android bind service with intent filter所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(68)

评论列表共有 0 条评论

立即
投稿
返回
顶部