You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-5Lines changed: 25 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# TimeoutSensor
2
2
Timeout Sensor for Android Applications
3
3
4
+

5
+
4
6
This library will make it easy to set a session timeout duration and monitor the application for inactivity. If there has not been any user interaction for the specified amount of time, a dialog will pop up and give the user an additional 30 seconds to respond otherwise the application will kill itself.
5
7
6
8
Make sure to add to your gradle:
@@ -14,22 +16,26 @@ Make sure to add to your gradle:
14
16
15
17
16
18
dependencies {
17
-
compile 'com.github.buradd:TimeoutSensor:1.6'
19
+
compile 'com.github.buradd:TimeoutSensor:1.8'
18
20
}
19
21
20
-
To use, you must be using AppCompat - and replace each Activity extention with TimeoutCompatActivity:
22
+
To use, you must extend all of your activities with TimeoutActivity (or TimeoutCompatActivity if you use AppCompat):
23
+
24
+
public class MainActivity extends TimeoutActivity {
25
+
26
+
}
27
+
28
+
//OR IF YOU USE APPCOMPAT,
21
29
22
30
public class MainActivity extends TimeoutCompatActivity {
23
31
24
32
}
25
33
26
-
27
34
Then, start the sensor and provide the duration (in minutes.):
28
35
29
36
//This will start the sensor to check for 15 minutes of inactivity.
30
37
TimeoutSensor.start(15);
31
38
32
-
33
39
You can also set the duration and call start separately:
34
40
35
41
TimeoutSensor.setTimeoutDuration(15);
@@ -39,9 +45,23 @@ You may stop the sensor at any time:
39
45
40
46
TimeoutSensor.stop();
41
47
48
+
The dialog fragment can be customized:
49
+
50
+
//set the Title
51
+
TimeoutSensor.setDialogTitle("ATTENTION:");
52
+
53
+
//set the Message
54
+
TimeoutSensor.setDialogMessage("Your session is about to expire.");
55
+
56
+
//set the Button Text
57
+
TimeoutSensor.setDialogButton("STAY SIGNED IN");
42
58
59
+
//set the TextView Text (this can take %s which will be replaced by the remaining seconds of the dialogs timer)
60
+
TimeoutSensor.setDialogTextview("Session will expire in: %s seconds.");
0 commit comments