-
Notifications
You must be signed in to change notification settings - Fork 0
/
watchReminderQ.java
42 lines (33 loc) · 1.07 KB
/
watchReminderQ.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Vibrator;
import android.support.wearable.activity.WearableActivity;
import android.util.Log;
public class ReminderActivity extends WearableActivity {
private static final String TAG = "ReminderActivity";
private Vibrator vibrator;
private Handler handler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reminder);
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
}
@Override
protected void onResume() {
super.onResume();
handler.postDelayed(new Runnable() {
@Override
public void run() {
vibrator.vibrate(500);
handler.postDelayed(this, 300000); // 5 minutes in milliseconds
}
}, 0);
}
@Override
protected void onPause() {
super.onPause();
handler.removeCallbacksAndMessages(null);
}
}