2017-01-23 89 views
1

我創建了一個jobschedular服務如何申請jobschedular下面棒棒糖

public class JobSchedularService extends JobService { 

    //called when instance is created. 
    @Override 
    public void onCreate() { 
     super.onCreate(); 
     Log.e("jobservice","oncreate called"); 
    } 

    //called when service instance is destroyed. 
    @Override 
    public void onDestroy() { 
     super.onDestroy(); 
     Log.e("jobservice","ondestroy called"); 
    } 

    @Override 
    public boolean onStartJob(JobParameters jobParameters) { 
     Log.e("job start"," called"); 
     return true; 
    } 

    @Override 
    public boolean onStopJob(JobParameters jobParameters) { 
     Log.e("job stop","called"); 
     return false; 
    } 
} 

,並使用jobschedular安排工作調用它。 但它只適用於21以上,那麼API 21下面可以應用什麼?

+1

https://github.com/firebase/firebase-jobdispatcher-android – siva35

回答

0

使用GCM Network Manager相反,它允許你安排任務,並使用作業調度程序上API21及以上。

+0

GCM已被棄用,你甚至察覺不到嗎? – user1209216