我是靠谱客的博主 秀丽手链,这篇文章主要介绍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内容请搜索靠谱客的其他文章。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部