stopService doesn't stop's my service… why?

前端 未结 11 886
旧巷少年郎
旧巷少年郎 2020-12-03 07:02

i have a background service on my android APP that is getting my GPS position and sending it to a remote db. It work\'s fine.

The problem is when i want to stop the

11条回答
  •  情歌与酒
    2020-12-03 07:35

    it could be perhaps that you are creating a new Intent everytime you call the stop service.

    stopService(new Intent(GPSLoc.this, MyService.class));
    

    perhaps try :

    Intent intnet = new Intent(GPSLoc.this, MyService.class); // create el service
    
    startService(intenet); 
    stopService(intent);
    

提交回复
热议问题