Actually I want to update my location for every minute to the server, I have looked into so many links but none of them working fine for me.Finally I got this link
I have tried this link:
https://deepshikhapuri.wordpress.com/2016/11/25/service-in-android/
for getting the location in a service.I am using the sourcecode from the link but I cannot able to stop the service and BroadcastReceiver
I am starting the Service and BroadcastReceiver like following code
//Starting Service
Intent intent = new Intent(getApplicationContext(), GoogleService.class);
startService(intent);
//Starting BroadcastReceiver
registerReceiver(broadcastReceiver, new IntentFilter(GoogleService.str_receiver));
I have tried the below code to stop service and BroadcastReceiver.
//Unregistering BroadcastReceiver
LocalBroadcastManager.getInstance(ServiceLocActivity.this).unregisterReceiver(broadcastReceiver);
//stopping service
Intent it = new Intent(getApplicationContext(), GoogleService.class);
stopService(it);
The above code is not working. I cannot able to stop Service and Broadcast Receiver Can you please help me on this.Thanks in Advance.