Start service in Android

前端 未结 5 1521
醉梦人生
醉梦人生 2020-11-27 14:07

I want to call a service when a certain activity starts. So, here\'s the Service class:

public class UpdaterServiceManager extends Service {

    private fin         


        
5条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 14:26

    Intent serviceIntent = new Intent(this,YourActivity.class);
    
    startService(serviceIntent);
    

    add service in manifist

    
    

    for running service on oreo and greater devices use for ground service and show notification to user

    or use geofencing service for location update in background reference http://stackoverflow.com/questions/tagged/google-play-services

提交回复
热议问题