2017-10-05 75 views
1

我的應用程序的location update service不在nougat設備的列表中顯示。但它顯示在較低的設備上。服務沒有在牛軋糖背景中運行

@Override 
public int onStartCommand(Intent intent, int flags, int startId) { 
    super.onStartCommand(intent, flags, startId); 

    return START_STICKY; 
} 

回答

1

這是由於Android的7.0後臺執行限制,您可以選擇使用作業調度程序或服務的前景在background.refer獲取位置Android 7.0 platform changes

+0

利用前景的服務,總是顯示通知。給我一個工作調度程序的例子。 –

+0

@vivekmodi沒有這樣的直接示例可用我會發布它,如果我發現它 –

+0

@vivekmodi參考此https://stackoverflow.com/questions/43752293/location-updates-using-jobscheduler-api/43752497#43752497 –

相關問題