@@ -26,6 +26,7 @@ public class QueueITEngine {
2626 private QueueCache _queueCache ;
2727 private Context _context ;
2828
29+ private Activity _activity ;
2930 private boolean _requestInProgress ;
3031 private boolean _isInQueue ;
3132
@@ -38,12 +39,12 @@ public class QueueITEngine {
3839 private Handler _checkConnectionHandler ;
3940 private int _isOnlineRetry = 0 ;
4041
41- public QueueITEngine (Activity activity , String customerId , String eventOrAliasId , QueueListener queueListener )
42+ public QueueITEngine (Context applicationContext , String customerId , String eventOrAliasId , QueueListener queueListener )
4243 {
43- this (activity , customerId , eventOrAliasId , "" , "" , queueListener );
44+ this (applicationContext , customerId , eventOrAliasId , "" , "" , queueListener );
4445 }
4546
46- public QueueITEngine (Activity activity , String customerId , String eventOrAliasId , String layoutName ,
47+ public QueueITEngine (Context applicationContext , String customerId , String eventOrAliasId , String layoutName ,
4748 String language , QueueListener queueListener )
4849 {
4950 if (TextUtils .isEmpty (customerId ))
@@ -54,13 +55,13 @@ public QueueITEngine(Activity activity, String customerId, String eventOrAliasId
5455 {
5556 throw new IllegalArgumentException ("eventOrAliasId must have a value" );
5657 }
57- _context = activity .getApplicationContext ();
58+ _context = applicationContext .getApplicationContext ();
5859 _customerId = customerId ;
5960 _eventOrAliasId = eventOrAliasId ;
6061 _layoutName = layoutName ;
6162 _language = language ;
6263 _queueListener = queueListener ;
63- _queueCache = new QueueCache (activity , customerId , eventOrAliasId );
64+ _queueCache = new QueueCache (_context , customerId , eventOrAliasId );
6465 _deltaSec = INITIAL_WAIT_RETRY_SEC ;
6566 }
6667
@@ -86,17 +87,18 @@ private boolean isOnline() {
8687 return netInfo != null && netInfo .isConnected ();
8788 }
8889
89- public void run (boolean clearCache ) throws QueueITException
90+ public void run (Activity activity , boolean clearCache ) throws QueueITException
9091 {
9192 if (clearCache )
9293 {
9394 _queueCache .clear ();
9495 }
95- run ();
96+ run (activity );
9697 }
9798
98- public void run () throws QueueITException
99+ public void run (Activity activity ) throws QueueITException
99100 {
101+ _activity = activity ;
100102 registerReceivers ();
101103
102104 if (_requestInProgress )
@@ -189,7 +191,7 @@ private void showQueue(String queueUrl, final String targetUrl)
189191 Intent intent = new Intent (_context , QueueActivity .class );
190192 intent .putExtra ("queueUrl" , queueUrl );
191193 intent .putExtra ("targetUrl" , targetUrl );
192- _context .startActivity (intent );
194+ _activity .startActivity (intent );
193195 }
194196
195197 private void raiseQueueViewWillOpen ()
0 commit comments