Click here to Skip to main content
15,917,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
We are facing issue while start and stop background service in oreo 8.0

Error :
FATAL EXCEPTION: main
Process: com.phonov1.app, PID: 4121
android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6626)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)


What I have tried:

I have tried to start service
Intent in = new Intent(this,GpsService.class);
startService(in); // for android version below 8.0

startForegroundService(in) //for android version 8.0

and I have tried to stop service by

stopService(new Intent(this,GpsService.class));
Posted
Comments
David Crow 9-Oct-18 11:32am    
Does anything suggested here help?
Member 14013230 11-Oct-18 2:21am    
Any help ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900