Skip to content

Commit 5348ce7

Browse files
Merge remote-tracking branch 'origin/master'
2 parents 768edf2 + 8db9d8d commit 5348ce7

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# TimeoutSensor
22
Timeout Sensor for Android Applications
33

4+
![img](http://i.imgur.com/qesbp7B.png)
5+
46
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.
57

68
Make sure to add to your gradle:
@@ -14,22 +16,26 @@ Make sure to add to your gradle:
1416

1517

1618
dependencies {
17-
compile 'com.github.buradd:TimeoutSensor:1.6'
19+
compile 'com.github.buradd:TimeoutSensor:1.8'
1820
}
1921

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,
2129

2230
public class MainActivity extends TimeoutCompatActivity {
2331

2432
}
2533

26-
2734
Then, start the sensor and provide the duration (in minutes.):
2835

2936
//This will start the sensor to check for 15 minutes of inactivity.
3037
TimeoutSensor.start(15);
3138

32-
3339
You can also set the duration and call start separately:
3440

3541
TimeoutSensor.setTimeoutDuration(15);
@@ -39,9 +45,23 @@ You may stop the sensor at any time:
3945

4046
TimeoutSensor.stop();
4147

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");
4258

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.");
61+
62+
![img](http://i.imgur.com/qesbp7B.png)
63+
4364
There is a sample APK available here:
4465
https://github.com/buradd/TimeoutSensor/blob/master/sample/app/TimeoutSensorSample.apk
4566

46-
4767
That's it!

0 commit comments

Comments
 (0)