新增测试HeartBeat的广播

lowmem
liuguijing 2 months ago
parent 62de685e4e
commit 9ff79bbe1b

@ -0,0 +1,16 @@
package com.xypower.mpapp;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class HeartBeatResponseReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if ("heartbeat".equals(action)) {
MicroPhotoService.infoLog("收到heartbeat广播");
}
}
}

@ -500,6 +500,12 @@ public class MicroPhotoService extends Service {
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
Intent responseIntent = new Intent("com.systemui.ACTION_HEARTBEAT_RESPONSE");
responseIntent.putExtra("timestamp",System.currentTimeMillis());
context.sendBroadcast(responseIntent);
} else if (TextUtils.equals(ACTION_TAKE_PHOTO, action)) { } else if (TextUtils.equals(ACTION_TAKE_PHOTO, action)) {
long ts = intent.getLongExtra(EXTRA_PARAM_TIME, 0); long ts = intent.getLongExtra(EXTRA_PARAM_TIME, 0);
int cnt = intent.getIntExtra(EXTRA_PARAM_SCHEDULES, 0); int cnt = intent.getIntExtra(EXTRA_PARAM_SCHEDULES, 0);

Loading…
Cancel
Save