Android-每天或连接到internet时下载包含事件列表的XML+;如何发送计划通知?
这是我的密码: 在FeedReader.class和GiveawayReader.class中,我从Web服务器读取XML。有人知道如何按计划每天或每小时进行吗?或在连接到internet时触发更新 我还想为即将开始的活动、发现赠品或即将过期的活动添加警报 我不知道要查找什么,因为我可能使用了错误的搜索词,但在Java API中遇到了以下问题:Android-每天或连接到internet时下载包含事件列表的XML+;如何发送计划通知?,android,download,notifications,schedule,Android,Download,Notifications,Schedule,这是我的密码: 在FeedReader.class和GiveawayReader.class中,我从Web服务器读取XML。有人知道如何按计划每天或每小时进行吗?或在连接到internet时触发更新 我还想为即将开始的活动、发现赠品或即将过期的活动添加警报 我不知道要查找什么,因为我可能使用了错误的搜索词,但在Java API中遇到了以下问题: -AlarmManager将AlarmManager用于每日或小时 Intent intent = new Intent(mContext, Check
-AlarmManager将AlarmManager用于每日或小时
Intent intent = new Intent(mContext, CheckEventService.class);
PendingIntent pintent = PendingIntent.getService(mContext, 1, intent, 0);
AlarmManager alarm = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
alarm.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), Constants.UPDATE_AFTER_TIME_ELAPSED, pintent);
如果要在设备关闭后调用alarm manager,请使用引导接收器完成
互联网连接-互联网开启时使用广播接收器-
<receiver android:name=".NetworkChanged" >
<intent-filter>
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
<action android:name="android.net.wifi.supplicant.CONNECTION_CHANGE" />
</intent-filter>
</receiver>
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.BatteryManager;
import android.webkit.WebView.FindListener;
import android.widget.TextView;
import android.widget.Toast;
public class NetworkChanged extends BroadcastReceiver {
WifiManager wifiManager;
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "On Receive calling", Toast.LENGTH_SHORT).show();
wifiManager=(WifiManager)context.getSystemService(Context.WIFI_SERVICE);
int state=wifiManager.getWifiState();
if(state==WifiManager.WIFI_STATE_DISABLED)
{
}
WifiInfo wifiInfo= wifiManager.getConnectionInfo();
//
// }
}
}