我正在尝试从 AsyncTask 启动服务,但看不到它的启动。我还在清单文件中添加了服务。
这里是代码:
protected Integer doInBackground(Void... values) throws InterruptedException {
//starts service number activite
Intent serviceIntent = new Intent();
serviceIntent.setAction("services.conServise");
context.startService(serviceIntent);
和清单文件:
<service android:name="services.conServise"></service>
</application>
感谢帮助。
services.conServise
应该在一个<action>
内的标签<intent-filter>
该服务声明的标签,请更换服务类名例如,使用适当的包名称,org.mypkg.foo.bar.
<service android:name="<servicesclassname>">
<intent-filter>
<action android:name="services.conServise"/>
</intent-filter>
</service>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)