ActivityNotFoundException while trying to start a service.

前端 未结 2 1296
悲哀的现实
悲哀的现实 2021-01-21 12:58

I am getting an Activity not found exception while trying to start a service. I have the service registered in the Manifest. Adding what I think is the relevant code and the Log

2条回答
  •  天涯浪人
    2021-01-21 13:57

    GPSService is a service. It is not an Activity. You cant do as

     getActivity().startActivity(intent);
    

    instead of do startService(intent);

    For more information refer Docs

提交回复
热议问题