版权声明:本文出自朋永的博客,转载必须注明出处。 https://blog.csdn.net/VNanyesheshou/article/details/82259897
记录平常遇见的问题
Unable to start service Intent { act=com.py.wifidirect.SEND_FILE
cmp=com.py.wifidirect/.FileTransferService (has extras) } U=0: not found
启动Service的代码如下:
Intent serviceIntent = new Intent(getActivity(), FileTransferService.class);
serviceIntent.setAction("com.py.wifidirect.SEND_FILE");
getActivity().startService(serviceIntent);
后来发现AndroidManifest.xml中未注册service,需要添加注册信息。
<service android:enabled="true"
android:name=".FileTransferService" >
<intent-filter>
<action android:name="com.py.wifidirect.SEND_FILE" />
</intent-filter>
</service>