Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/210.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中的特定时间在后台每天一次在sqlite中插入数据?_Android_Android Studio_Android Service_Alarmmanager - Fatal编程技术网

如何在android中的特定时间在后台每天一次在sqlite中插入数据?

如何在android中的特定时间在后台每天一次在sqlite中插入数据?,android,android-studio,android-service,alarmmanager,Android,Android Studio,Android Service,Alarmmanager,我的任务是每天10:00在后台根据某些条件在sqlite中插入或更新某些特定数据。我被卡住了。请帮忙 MakeYourReceiver.java文件 class YourReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().matches(Intent.ACTION_

我的任务是每天10:00在后台根据某些条件在sqlite中插入或更新某些特定数据。我被卡住了。请帮忙

Make
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 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()
方法每分钟都会被调用。

没有任何代码如何帮助您..如何开发一个在一天一次的特定时间在后台运行的服务..这将解决我的问题。这应该对你有帮助