android 启动其他app的service,Android start service of an app from another android app

在尝试从一个已安装的应用启动另一个应用中的NotificationService时遇到问题。已通过Intent设置了ComponentName,但在第二个应用的manifest中声明了服务并设置为exported=true。然而,NotificationService并未启动。可能的原因包括权限问题、服务声明错误或者应用程序间交互的配置不正确。需要检查相关配置和代码以找出解决方案。
摘要由CSDN通过智能技术生成

I have two applications installed on the device: from one app I want to start a service as follows:

Intent i = new Intent();

i.setComponent(new ComponentName("com.app.service", "com.app.service.NotificationService"));

context.startService(i);

The second app is only installed but not started.

What I want is to start the notification service(which should create a notification) from the second service by using the above code.

In the manifest file of the second app I declare the service as follows:

android:name=".service.NotificationService"

android:exported="true" />

The problem is that the Notification Service from the second app does not start.

Any ideas on why this happens?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值