-1
내 작업은 백그라운드에서 매일 10시에 일부 조건을 기반으로 sqlite의 특정 데이터를 삽입하거나 업데이트하는 것입니다. 나는 붙어있다. 도와주세요.backgroud에서 android에서 특정 시간에 하루에 한 번 sqlite에 데이터를 삽입 하시겠습니까?
내 작업은 백그라운드에서 매일 10시에 일부 조건을 기반으로 sqlite의 특정 데이터를 삽입하거나 업데이트하는 것입니다. 나는 붙어있다. 도와주세요.backgroud에서 android에서 특정 시간에 하루에 한 번 sqlite에 데이터를 삽입 하시겠습니까?
만들기 YourReceiver.java
파일,
class YourReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().matches(Intent.ACTION_TIME_TICK)) {
if (check_your_time_with_system_time) {
// update your DB here
}
}
}
}
는 manifest.xml에 Receiver
을 등록합니다.
<receiver android:name=".YourReceiver">
<intent-filter>
<action android:name="android.intent.action.TIME_TICK"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
는 YourReceiver
의 onReceive()
방법은 매 분마다 호출됩니다.
코드를 사용하는 방법 .. –
하루에 한 번 특정 시간에 백그라운드에서 실행되는 서비스를 개발하는 방법. 내 문제가 해결됩니다. – Raj
https://stackoverflow.com/questions/7845660/how-to-run-a-service-every-day-at-noon-and-on-every-boot이 정보는 도움이됩니다. – Thunder