onfocusio-mobileesp_converted 0.2.3.onf2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1305 @@
1
+ /* *******************************************
2
+ // Copyright 2010-2015, Anthony Hand
3
+ //
4
+ //
5
+ // File version 2015.05.13 (May 13, 2015)
6
+ // Updates:
7
+ // - Moved MobileESP to GitHub. https://github.com/ahand/mobileesp
8
+ // - Opera Mobile/Mini browser has the same UA string on multiple platforms and doesn't differentiate phone vs. tablet.
9
+ // - Removed DetectOperaAndroidPhone(). This method is no longer reliable.
10
+ // - Removed DetectOperaAndroidTablet(). This method is no longer reliable.
11
+ // - Added support for Windows Phone 10: variable and DetectWindowsPhone10()
12
+ // - Updated DetectWindowsPhone() to include WP10.
13
+ // - Added support for Firefox OS.
14
+ // - A variable plus DetectFirefoxOS(), DetectFirefoxOSPhone(), DetectFirefoxOSTablet()
15
+ // - NOTE: Firefox doesn't add UA tokens to definitively identify Firefox OS vs. their browsers on other mobile platforms.
16
+ // - Added support for Sailfish OS. Not enough info to add a tablet detection method at this time.
17
+ // - A variable plus DetectSailfish(), DetectSailfishPhone()
18
+ // - Added support for Ubuntu Mobile OS.
19
+ // - DetectUbuntu(), DetectUbuntuPhone(), DetectUbuntuTablet()
20
+ // - Added support for 2 smart TV OSes. They lack browsers but do have WebViews for use by HTML apps.
21
+ // - One variable for Samsung Tizen TVs, plus DetectTizenTV()
22
+ // - One variable for LG WebOS TVs, plus DetectWebOSTV()
23
+ // - Updated DetectTizen(). Now tests for "mobile" to disambiguate from Samsung Smart TVs
24
+ // - Removed variables for obsolete devices: deviceHtcFlyer, deviceXoom.
25
+ // - Updated DetectAndroid(). No longer has a special test case for the HTC Flyer tablet.
26
+ // - Updated DetectAndroidPhone().
27
+ // - Updated internal detection code for Android.
28
+ // - No longer has a special test case for the HTC Flyer tablet.
29
+ // - Checks against DetectOperaMobile() on Android and reports here if relevant.
30
+ // - Updated DetectAndroidTablet().
31
+ // - No longer has a special test case for the HTC Flyer tablet.
32
+ // - Checks against DetectOperaMobile() on Android to exclude it from here.
33
+ // - DetectMeego(): Changed definition for this method. Now detects any Meego OS device, not just phones.
34
+ // - DetectMeegoPhone(): NEW. For Meego phones. Ought to detect Opera browsers on Meego, as well.
35
+ // - DetectTierIphone(): Added support for phones running Sailfish, Ubuntu and Firefox Mobile.
36
+ // - DetectTierTablet(): Added support for tablets running Ubuntu and Firefox Mobile.
37
+ // - DetectSmartphone(): Added support for Meego phones.
38
+ // - Refactored the detection logic in DetectMobileQuick() and DetectMobileLong().
39
+ // - Moved a few detection tests for older browsers to Long.
40
+ //
41
+ //
42
+ //
43
+ // LICENSE INFORMATION
44
+ // Licensed under the Apache License, Version 2.0 (the "License");
45
+ // you may not use this file except in compliance with the License.
46
+ // You may obtain a copy of the License at
47
+ // http://www.apache.org/licenses/LICENSE-2.0
48
+ // Unless required by applicable law or agreed to in writing,
49
+ // software distributed under the License is distributed on an
50
+ // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
51
+ // either express or implied. See the License for the specific
52
+ // language governing permissions and limitations under the License.
53
+ //
54
+ //
55
+ // ABOUT THIS PROJECT
56
+ // Project Owner: Anthony Hand
57
+ // Email: anthony.hand@gmail.com
58
+ // Web Site: http://www.mobileesp.com
59
+ // Source Files: https://github.com/ahand/mobileesp
60
+ //
61
+ // Versions of this code are available for:
62
+ // PHP, JavaScript, Java, ASP.NET (C#), and Ruby
63
+ //
64
+ // *******************************************
65
+ */
66
+ package com.handinteractive.mobile;
67
+
68
+ /**
69
+ * The DetectSmartPhone class encapsulates information about
70
+ * a browser's connection to your web site.
71
+ * You can use it to find out whether the browser asking for
72
+ * your site's content is probably running on a mobile device.
73
+ * The methods were written so you can be as granular as you want.
74
+ * For example, enquiring whether it's as specific as an iPod Touch or
75
+ * as general as a smartphone class device.
76
+ * The object's methods return true, or false.
77
+ */
78
+ public class UAgentInfo {
79
+ // User-Agent and Accept HTTP request headers
80
+
81
+ private String userAgent = "";
82
+ private String httpAccept = "";
83
+
84
+ // Let's store values for quickly accessing the same info multiple times.
85
+ public boolean initCompleted = false;
86
+ public boolean isWebkit = false; //Stores the result of DetectWebkit()
87
+ public boolean isMobilePhone = false; //Stores the result of DetectMobileQuick()
88
+ public boolean isIphone = false; //Stores the result of DetectIphone()
89
+ public boolean isAndroid = false; //Stores the result of DetectAndroid()
90
+ public boolean isAndroidPhone = false; //Stores the result of DetectAndroidPhone()
91
+ public boolean isTierTablet = false; //Stores the result of DetectTierTablet()
92
+ public boolean isTierIphone = false; //Stores the result of DetectTierIphone()
93
+ public boolean isTierRichCss = false; //Stores the result of DetectTierRichCss()
94
+ public boolean isTierGenericMobile = false; //Stores the result of DetectTierOtherPhones()
95
+
96
+ // Initialize some initial smartphone string variables.
97
+ public static final String engineWebKit = "webkit";
98
+
99
+ public static final String deviceIphone = "iphone";
100
+ public static final String deviceIpod = "ipod";
101
+ public static final String deviceIpad = "ipad";
102
+ public static final String deviceMacPpc = "macintosh"; //Used for disambiguation
103
+
104
+ public static final String deviceAndroid = "android";
105
+ public static final String deviceGoogleTV = "googletv";
106
+
107
+ public static final String deviceWinPhone7 = "windows phone os 7";
108
+ public static final String deviceWinPhone8 = "windows phone 8";
109
+ public static final String deviceWinPhone10 = "windows phone 10";
110
+ public static final String deviceWinMob = "windows ce";
111
+ public static final String deviceWindows = "windows";
112
+ public static final String deviceIeMob = "iemobile";
113
+ public static final String devicePpc = "ppc"; //Stands for PocketPC
114
+ public static final String enginePie = "wm5 pie"; //An old Windows Mobile
115
+
116
+ public static final String deviceBB = "blackberry";
117
+ public static final String deviceBB10 = "bb10"; //For the new BB 10 OS
118
+ public static final String vndRIM = "vnd.rim"; //Detectable when BB devices emulate IE or Firefox
119
+ public static final String deviceBBStorm = "blackberry95"; //Storm 1 and 2
120
+ public static final String deviceBBBold = "blackberry97"; //Bold 97x0 (non-touch)
121
+ public static final String deviceBBBoldTouch = "blackberry 99"; //Bold 99x0 (touchscreen)
122
+ public static final String deviceBBTour = "blackberry96"; //Tour
123
+ public static final String deviceBBCurve = "blackberry89"; //Curve 2
124
+ public static final String deviceBBCurveTouch = "blackberry 938"; //Curve Touch 9380
125
+ public static final String deviceBBTorch = "blackberry 98"; //Torch
126
+ public static final String deviceBBPlaybook = "playbook"; //PlayBook tablet
127
+
128
+ public static final String deviceSymbian = "symbian";
129
+ public static final String deviceS60 = "series60";
130
+ public static final String deviceS70 = "series70";
131
+ public static final String deviceS80 = "series80";
132
+ public static final String deviceS90 = "series90";
133
+
134
+ public static final String devicePalm = "palm";
135
+ public static final String deviceWebOS = "webos"; //For Palm devices
136
+ public static final String deviceWebOStv = "web0s"; //For LG TVs
137
+ public static final String deviceWebOShp = "hpwos"; //For HP's line of WebOS devices
138
+
139
+ public static final String deviceNuvifone = "nuvifone"; //Garmin Nuvifone
140
+ public static final String deviceBada = "bada"; //Samsung's Bada OS
141
+ public static final String deviceTizen = "tizen"; //Tizen OS
142
+ public static final String deviceMeego = "meego"; //Meego OS
143
+ public static final String deviceSailfish = "sailfish"; //Sailfish OS
144
+ public static final String deviceUbuntu = "ubuntu"; //Ubuntu Mobile OS
145
+
146
+ public static final String deviceKindle = "kindle"; //Amazon Kindle, eInk one
147
+ public static final String engineSilk = "silk-accelerated"; //Amazon's accelerated Silk browser for Kindle Fire
148
+
149
+ public static final String engineBlazer = "blazer"; //Old Palm
150
+ public static final String engineXiino = "xiino"; //Another old Palm
151
+
152
+ //Initialize variables for mobile-specific content.
153
+ public static final String vndwap = "vnd.wap";
154
+ public static final String wml = "wml";
155
+
156
+ //Initialize variables for other random devices and mobile browsers.
157
+ public static final String deviceTablet = "tablet"; //Generic term for slate and tablet devices
158
+ public static final String deviceBrew = "brew";
159
+ public static final String deviceDanger = "danger";
160
+ public static final String deviceHiptop = "hiptop";
161
+ public static final String devicePlaystation = "playstation";
162
+ public static final String devicePlaystationVita = "vita";
163
+ public static final String deviceNintendoDs = "nitro";
164
+ public static final String deviceNintendo = "nintendo";
165
+ public static final String deviceWii = "wii";
166
+ public static final String deviceXbox = "xbox";
167
+ public static final String deviceArchos = "archos";
168
+
169
+ public static final String engineFirefox = "firefox"; //For Firefox OS
170
+ public static final String engineOpera = "opera"; //Popular browser
171
+ public static final String engineNetfront = "netfront"; //Common embedded OS browser
172
+ public static final String engineUpBrowser = "up.browser"; //common on some phones
173
+ public static final String engineOpenWeb = "openweb"; //Transcoding by OpenWave server
174
+ public static final String deviceMidp = "midp"; //a mobile Java technology
175
+ public static final String uplink = "up.link";
176
+ public static final String engineTelecaQ = "teleca q"; //a modern feature phone browser
177
+ public static final String devicePda = "pda"; //some devices report themselves as PDAs
178
+ public static final String mini = "mini"; //Some mobile browsers put "mini" in their names.
179
+ public static final String mobile = "mobile"; //Some mobile browsers put "mobile" in their user agent strings.
180
+ public static final String mobi = "mobi"; //Some mobile browsers put "mobi" in their user agent strings.
181
+
182
+ //Smart TV strings
183
+ public static final String smartTV1 = "smart-tv"; //Samsung Tizen smart TVs
184
+ public static final String smartTV2 = "smarttv"; //LG WebOS smart TVs
185
+
186
+ //Use Maemo, Tablet, and Linux to test for Nokia"s Internet Tablets.
187
+ public static final String maemo = "maemo";
188
+ public static final String linux = "linux";
189
+ public static final String qtembedded = "qt embedded"; //for Sony Mylo
190
+ public static final String mylocom2 = "com2"; //for Sony Mylo also
191
+
192
+ //In some UserAgents, the only clue is the manufacturer.
193
+ public static final String manuSonyEricsson = "sonyericsson";
194
+ public static final String manuericsson = "ericsson";
195
+ public static final String manuSamsung1 = "sec-sgh";
196
+ public static final String manuSony = "sony";
197
+ public static final String manuHtc = "htc"; //Popular Android and WinMo manufacturer
198
+
199
+ //In some UserAgents, the only clue is the operator.
200
+ public static final String svcDocomo = "docomo";
201
+ public static final String svcKddi = "kddi";
202
+ public static final String svcVodafone = "vodafone";
203
+
204
+ //Disambiguation strings.
205
+ public static final String disUpdate = "update"; //pda vs. update
206
+
207
+
208
+ /**
209
+ * Initialize the userAgent and httpAccept variables
210
+ *
211
+ * @param userAgent the User-Agent header
212
+ * @param httpAccept the Accept header
213
+ */
214
+ public UAgentInfo(String userAgent, String httpAccept) {
215
+ if (userAgent != null) {
216
+ this.userAgent = userAgent.toLowerCase();
217
+ }
218
+ if (httpAccept != null) {
219
+ this.httpAccept = httpAccept.toLowerCase();
220
+ }
221
+
222
+ //Intialize key stored values.
223
+ initDeviceScan();
224
+ }
225
+
226
+ /**
227
+ * Return the lower case HTTP_USER_AGENT
228
+ * @return userAgent
229
+ */
230
+ public String getUserAgent() {
231
+ return userAgent;
232
+ }
233
+
234
+ /**
235
+ * Return the lower case HTTP_ACCEPT
236
+ * @return httpAccept
237
+ */
238
+ public String getHttpAccept() {
239
+ return httpAccept;
240
+ }
241
+
242
+ /**
243
+ * Return whether the device is an Iphone or iPod Touch
244
+ * @return isIphone
245
+ */
246
+ public boolean getIsIphone() {
247
+ return isIphone;
248
+ }
249
+
250
+ /**
251
+ * Return whether the device is in the Tablet Tier.
252
+ * @return isTierTablet
253
+ */
254
+ public boolean getIsTierTablet() {
255
+ return isTierTablet;
256
+ }
257
+
258
+ /**
259
+ * Return whether the device is in the Iphone Tier.
260
+ * @return isTierIphone
261
+ */
262
+ public boolean getIsTierIphone() {
263
+ return isTierIphone;
264
+ }
265
+
266
+ /**
267
+ * Return whether the device is in the 'Rich CSS' tier of mobile devices.
268
+ * @return isTierRichCss
269
+ */
270
+ public boolean getIsTierRichCss() {
271
+ return isTierRichCss;
272
+ }
273
+
274
+ /**
275
+ * Return whether the device is a generic, less-capable mobile device.
276
+ * @return isTierGenericMobile
277
+ */
278
+ public boolean getIsTierGenericMobile() {
279
+ return isTierGenericMobile;
280
+ }
281
+
282
+ /**
283
+ * Initialize Key Stored Values.
284
+ */
285
+ public void initDeviceScan() {
286
+ //Save these properties to speed processing
287
+ this.isWebkit = detectWebkit();
288
+ this.isIphone = detectIphone();
289
+ this.isAndroid = detectAndroid();
290
+ this.isAndroidPhone = detectAndroidPhone();
291
+
292
+ //Generally, these tiers are the most useful for web development
293
+ this.isMobilePhone = detectMobileQuick();
294
+ this.isTierTablet = detectTierTablet();
295
+ this.isTierIphone = detectTierIphone();
296
+
297
+ //Optional: Comment these out if you NEVER use them
298
+ this.isTierRichCss = detectTierRichCss();
299
+ this.isTierGenericMobile = detectTierOtherPhones();
300
+
301
+ this.initCompleted = true;
302
+ }
303
+
304
+ /**
305
+ * Detects if the current device is an iPhone.
306
+ * @return detection of an iPhone
307
+ */
308
+ public boolean detectIphone() {
309
+ // The iPad and iPod touch say they're an iPhone! So let's disambiguate.
310
+ if (userAgent.indexOf(deviceIphone) != -1 &&
311
+ !detectIpad() &&
312
+ !detectIpod()) {
313
+ return true;
314
+ }
315
+ return false;
316
+ }
317
+
318
+ /**
319
+ * Detects if the current device is an iPod Touch.
320
+ * @return detection of an iPod Touch
321
+ */
322
+ public boolean detectIpod() {
323
+ if (userAgent.indexOf(deviceIpod) != -1) {
324
+ return true;
325
+ }
326
+ return false;
327
+ }
328
+
329
+ /**
330
+ * Detects if the current device is an iPad tablet.
331
+ * @return detection of an iPad
332
+ */
333
+ public boolean detectIpad() {
334
+ if (userAgent.indexOf(deviceIpad) != -1
335
+ && detectWebkit()) {
336
+ return true;
337
+ }
338
+ return false;
339
+ }
340
+
341
+ /**
342
+ * Detects if the current device is an iPhone or iPod Touch.
343
+ * @return detection of an iPhone or iPod Touch
344
+ */
345
+ public boolean detectIphoneOrIpod() {
346
+ //We repeat the searches here because some iPods may report themselves as an iPhone, which would be okay.
347
+ if (userAgent.indexOf(deviceIphone) != -1
348
+ || userAgent.indexOf(deviceIpod) != -1) {
349
+ return true;
350
+ }
351
+ return false;
352
+ }
353
+
354
+ /**
355
+ * Detects *any* iOS device: iPhone, iPod Touch, iPad.
356
+ * @return detection of an Apple iOS device
357
+ */
358
+ public boolean detectIos() {
359
+ if (detectIphoneOrIpod() || detectIpad()) {
360
+ return true;
361
+ }
362
+ return false;
363
+ }
364
+
365
+
366
+ /**
367
+ * Detects *any* Android OS-based device: phone, tablet, and multi-media player.
368
+ * Also detects Google TV.
369
+ * @return detection of an Android device
370
+ */
371
+ public boolean detectAndroid() {
372
+ if ((userAgent.indexOf(deviceAndroid) != -1) ||
373
+ detectGoogleTV())
374
+ return true;
375
+
376
+ return false;
377
+ }
378
+
379
+ /**
380
+ * Detects if the current device is a (small-ish) Android OS-based device
381
+ * used for calling and/or multi-media (like a Samsung Galaxy Player).
382
+ * Google says these devices will have 'Android' AND 'mobile' in user agent.
383
+ * Ignores tablets (Honeycomb and later).
384
+ * @return detection of an Android phone
385
+ */
386
+ public boolean detectAndroidPhone() {
387
+ //First, let's make sure we're on an Android device.
388
+ if (!detectAndroid())
389
+ return false;
390
+
391
+ //If it's Android and has 'mobile' in it, Google says it's a phone.
392
+ if (userAgent.indexOf(mobile) != -1)
393
+ return true;
394
+
395
+ //Special check for Android devices with Opera Mobile/Mini. They should report here.
396
+ if (detectOperaMobile())
397
+ return true;
398
+
399
+ return false;
400
+ }
401
+
402
+ /**
403
+ * Detects if the current device is a (self-reported) Android tablet.
404
+ * Google says these devices will have 'Android' and NOT 'mobile' in their user agent.
405
+ * @return detection of an Android tablet
406
+ */
407
+ public boolean detectAndroidTablet() {
408
+ //First, let's make sure we're on an Android device.
409
+ if (!detectAndroid())
410
+ return false;
411
+
412
+ //Special check for Android devices with Opera Mobile/Mini. They should NOT report here.
413
+ if (detectOperaMobile())
414
+ return false;
415
+
416
+ //Otherwise, if it's Android and does NOT have 'mobile' in it, Google says it's a tablet.
417
+ if ((userAgent.indexOf(mobile) > -1))
418
+ return false;
419
+ else
420
+ return true;
421
+ }
422
+
423
+ /**
424
+ * Detects if the current device is an Android OS-based device and
425
+ * the browser is based on WebKit.
426
+ * @return detection of an Android WebKit browser
427
+ */
428
+ public boolean detectAndroidWebKit() {
429
+ if (detectAndroid() && detectWebkit()) {
430
+ return true;
431
+ }
432
+ return false;
433
+ }
434
+
435
+ /**
436
+ * Detects if the current device is a GoogleTV.
437
+ * @return detection of GoogleTV
438
+ */
439
+ public boolean detectGoogleTV() {
440
+ if (userAgent.indexOf(deviceGoogleTV) != -1) {
441
+ return true;
442
+ }
443
+ return false;
444
+ }
445
+
446
+ /**
447
+ * Detects if the current browser is based on WebKit.
448
+ * @return detection of a WebKit browser
449
+ */
450
+ public boolean detectWebkit() {
451
+ if (userAgent.indexOf(engineWebKit) != -1) {
452
+ return true;
453
+ }
454
+ return false;
455
+ }
456
+
457
+ /**
458
+ * Detects if the current browser is the Symbian S60 Open Source Browser.
459
+ * @return detection of Symbian S60 Browser
460
+ */
461
+ public boolean detectS60OssBrowser() {
462
+ //First, test for WebKit, then make sure it's either Symbian or S60.
463
+ if (detectWebkit()
464
+ && (userAgent.indexOf(deviceSymbian) != -1
465
+ || userAgent.indexOf(deviceS60) != -1)) {
466
+ return true;
467
+ }
468
+ return false;
469
+ }
470
+
471
+ /**
472
+ *
473
+ * Detects if the current device is any Symbian OS-based device,
474
+ * including older S60, Series 70, Series 80, Series 90, and UIQ,
475
+ * or other browsers running on these devices.
476
+ * @return detection of SymbianOS
477
+ */
478
+ public boolean detectSymbianOS() {
479
+ if (userAgent.indexOf(deviceSymbian) != -1
480
+ || userAgent.indexOf(deviceS60) != -1
481
+ || userAgent.indexOf(deviceS70) != -1
482
+ || userAgent.indexOf(deviceS80) != -1
483
+ || userAgent.indexOf(deviceS90) != -1) {
484
+ return true;
485
+ }
486
+ return false;
487
+ }
488
+
489
+ /**
490
+ * Detects if the current browser is a Windows Phone 7.x, 8, or 10 device
491
+ * @return detection of Windows Phone 7.x OR 8
492
+ */
493
+ public boolean detectWindowsPhone() {
494
+ if (detectWindowsPhone7()
495
+ || detectWindowsPhone8()
496
+ || detectWindowsPhone10()) {
497
+ return true;
498
+ }
499
+ return false;
500
+ }
501
+
502
+ /**
503
+ * Detects a Windows Phone 7 device (in mobile browsing mode).
504
+ * @return detection of Windows Phone 7
505
+ */
506
+ public boolean detectWindowsPhone7() {
507
+ if (userAgent.indexOf(deviceWinPhone7) != -1) {
508
+ return true;
509
+ }
510
+ return false;
511
+ }
512
+
513
+ /**
514
+ * Detects a Windows Phone 8 device (in mobile browsing mode).
515
+ * @return detection of Windows Phone 8
516
+ */
517
+ public boolean detectWindowsPhone8() {
518
+ if (userAgent.indexOf(deviceWinPhone8) != -1) {
519
+ return true;
520
+ }
521
+ return false;
522
+ }
523
+
524
+ /**
525
+ * Detects a Windows Phone 10 device (in mobile browsing mode).
526
+ * @return detection of Windows Phone 10
527
+ */
528
+ public boolean detectWindowsPhone10() {
529
+ if (userAgent.indexOf(deviceWinPhone10) != -1) {
530
+ return true;
531
+ }
532
+ return false;
533
+ }
534
+
535
+ /**
536
+ * Detects if the current browser is a Windows Mobile device.
537
+ * Excludes Windows Phone 7.x and 8 devices.
538
+ * Focuses on Windows Mobile 6.xx and earlier.
539
+ * @return detection of Windows Mobile
540
+ */
541
+ public boolean detectWindowsMobile() {
542
+ if (detectWindowsPhone()) {
543
+ return false;
544
+ }
545
+ //Most devices use 'Windows CE', but some report 'iemobile'
546
+ // and some older ones report as 'PIE' for Pocket IE.
547
+ // We also look for instances of HTC and Windows for many of their WinMo devices.
548
+ if (userAgent.indexOf(deviceWinMob) != -1
549
+ || userAgent.indexOf(deviceWinMob) != -1
550
+ || userAgent.indexOf(deviceIeMob) != -1
551
+ || userAgent.indexOf(enginePie) != -1
552
+ || (userAgent.indexOf(manuHtc) != -1 && userAgent.indexOf(deviceWindows) != -1)
553
+ || (detectWapWml() && userAgent.indexOf(deviceWindows) != -1)) {
554
+ return true;
555
+ }
556
+
557
+ //Test for Windows Mobile PPC but not old Macintosh PowerPC.
558
+ if (userAgent.indexOf(devicePpc) != -1 &&
559
+ !(userAgent.indexOf(deviceMacPpc) != -1))
560
+ return true;
561
+
562
+ return false;
563
+ }
564
+
565
+ /**
566
+ * Detects if the current browser is any BlackBerry.
567
+ * Includes BB10 OS, but excludes the PlayBook.
568
+ * @return detection of Blackberry
569
+ */
570
+ public boolean detectBlackBerry() {
571
+ if (userAgent.indexOf(deviceBB) != -1 ||
572
+ httpAccept.indexOf(vndRIM) != -1)
573
+ return true;
574
+
575
+ if (detectBlackBerry10Phone())
576
+ return true;
577
+
578
+ return false;
579
+ }
580
+
581
+ /**
582
+ * Detects if the current browser is a BlackBerry 10 OS phone.
583
+ * Excludes tablets.
584
+ * @return detection of a Blackberry 10 device
585
+ */
586
+ public boolean detectBlackBerry10Phone() {
587
+ if (userAgent.indexOf(deviceBB10) != -1 &&
588
+ userAgent.indexOf(mobile) != -1) {
589
+ return true;
590
+ }
591
+ return false;
592
+ }
593
+
594
+ /**
595
+ * Detects if the current browser is on a BlackBerry tablet device.
596
+ * Example: PlayBook
597
+ * @return detection of a Blackberry Tablet
598
+ */
599
+ public boolean detectBlackBerryTablet() {
600
+ if (userAgent.indexOf(deviceBBPlaybook) != -1) {
601
+ return true;
602
+ }
603
+ return false;
604
+ }
605
+
606
+ /**
607
+ * Detects if the current browser is a BlackBerry device AND uses a
608
+ * WebKit-based browser. These are signatures for the new BlackBerry OS 6.
609
+ * Examples: Torch. Includes the Playbook.
610
+ * @return detection of a Blackberry device with WebKit browser
611
+ */
612
+ public boolean detectBlackBerryWebKit() {
613
+ if (detectBlackBerry() &&
614
+ userAgent.indexOf(engineWebKit) != -1) {
615
+ return true;
616
+ }
617
+ return false;
618
+ }
619
+
620
+ /**
621
+ * Detects if the current browser is a BlackBerry Touch
622
+ * device, such as the Storm, Torch, and Bold Touch. Excludes the Playbook.
623
+ * @return detection of a Blackberry touchscreen device
624
+ */
625
+ public boolean detectBlackBerryTouch() {
626
+ if (detectBlackBerry() &&
627
+ (userAgent.indexOf(deviceBBStorm) != -1 ||
628
+ userAgent.indexOf(deviceBBTorch) != -1 ||
629
+ userAgent.indexOf(deviceBBBoldTouch) != -1 ||
630
+ userAgent.indexOf(deviceBBCurveTouch) != -1 )) {
631
+ return true;
632
+ }
633
+ return false;
634
+ }
635
+
636
+ /**
637
+ * Detects if the current browser is a BlackBerry device AND
638
+ * has a more capable recent browser. Excludes the Playbook.
639
+ * Examples, Storm, Bold, Tour, Curve2
640
+ * Excludes the new BlackBerry OS 6 and 7 browser!!
641
+ * @return detection of a Blackberry device with a better browser
642
+ */
643
+ public boolean detectBlackBerryHigh() {
644
+ //Disambiguate for BlackBerry OS 6 or 7 (WebKit) browser
645
+ if (detectBlackBerryWebKit())
646
+ return false;
647
+ if (detectBlackBerry()) {
648
+ if (detectBlackBerryTouch()
649
+ || userAgent.indexOf(deviceBBBold) != -1
650
+ || userAgent.indexOf(deviceBBTour) != -1
651
+ || userAgent.indexOf(deviceBBCurve) != -1) {
652
+ return true;
653
+ } else {
654
+ return false;
655
+ }
656
+ } else {
657
+ return false;
658
+ }
659
+ }
660
+
661
+ /**
662
+ * Detects if the current browser is a BlackBerry device AND
663
+ * has an older, less capable browser.
664
+ * Examples: Pearl, 8800, Curve1
665
+ * @return detection of a Blackberry device with a poorer browser
666
+ */
667
+ public boolean detectBlackBerryLow() {
668
+ if (detectBlackBerry()) {
669
+ //Assume that if it's not in the High tier, then it's Low
670
+ if (detectBlackBerryHigh()
671
+ || detectBlackBerryWebKit()) {
672
+ return false;
673
+ } else {
674
+ return true;
675
+ }
676
+ } else {
677
+ return false;
678
+ }
679
+ }
680
+
681
+ /**
682
+ * Detects if the current browser is on a PalmOS device.
683
+ * @return detection of a PalmOS device
684
+ */
685
+ public boolean detectPalmOS() {
686
+ //Most devices nowadays report as 'Palm', but some older ones reported as Blazer or Xiino.
687
+ if (userAgent.indexOf(devicePalm) != -1
688
+ || userAgent.indexOf(engineBlazer) != -1
689
+ || userAgent.indexOf(engineXiino) != -1) {
690
+ //Make sure it's not WebOS first
691
+ if (detectPalmWebOS()) {
692
+ return false;
693
+ } else {
694
+ return true;
695
+ }
696
+ }
697
+ return false;
698
+ }
699
+
700
+ /**
701
+ * Detects if the current browser is on a Palm device
702
+ * running the new WebOS.
703
+ * @return detection of a Palm WebOS device
704
+ */
705
+ public boolean detectPalmWebOS() {
706
+ if (userAgent.indexOf(deviceWebOS) != -1) {
707
+ return true;
708
+ }
709
+ return false;
710
+ }
711
+
712
+ /**
713
+ * Detects if the current browser is on an HP tablet running WebOS.
714
+ * @return detection of an HP WebOS tablet
715
+ */
716
+ public boolean detectWebOSTablet() {
717
+ if (userAgent.indexOf(deviceWebOShp) != -1 &&
718
+ userAgent.indexOf(deviceTablet) != -1) {
719
+ return true;
720
+ }
721
+ return false;
722
+ }
723
+
724
+ /**
725
+ * Detects if the current browser is on a WebOS smart TV.
726
+ * @return detection of a WebOS smart TV
727
+ */
728
+ public boolean detectWebOSTV() {
729
+ if (userAgent.indexOf(deviceWebOStv) != -1 &&
730
+ userAgent.indexOf(smartTV2) != -1) {
731
+ return true;
732
+ }
733
+ return false;
734
+ }
735
+
736
+ /**
737
+ * Detects Opera Mobile or Opera Mini.
738
+ * @return detection of an Opera browser for a mobile device
739
+ */
740
+ public boolean detectOperaMobile() {
741
+ if (userAgent.indexOf(engineOpera) != -1
742
+ && (userAgent.indexOf(mini) != -1
743
+ || userAgent.indexOf(mobi) != -1)) {
744
+ return true;
745
+ }
746
+ return false;
747
+ }
748
+
749
+ /**
750
+ * Detects if the current device is an Amazon Kindle (eInk devices only).
751
+ * Note: For the Kindle Fire, use the normal Android methods.
752
+ * @return detection of a Kindle
753
+ */
754
+ public boolean detectKindle() {
755
+ if (userAgent.indexOf(deviceKindle)!= -1 &&
756
+ !detectAndroid()) {
757
+ return true;
758
+ }
759
+ return false;
760
+ }
761
+
762
+ /**
763
+ * Detects if the current Amazon device is using the Silk Browser.
764
+ * Note: Typically used by the the Kindle Fire.
765
+ * @return detection of an Amazon Kindle Fire in Silk mode.
766
+ */
767
+ public boolean detectAmazonSilk() {
768
+ if (userAgent.indexOf(engineSilk) != -1) {
769
+ return true;
770
+ }
771
+ return false;
772
+ }
773
+
774
+ /**
775
+ * Detects if the current browser is a
776
+ * Garmin Nuvifone.
777
+ * @return detection of a Garmin Nuvifone
778
+ */
779
+ public boolean detectGarminNuvifone() {
780
+ if (userAgent.indexOf(deviceNuvifone) != -1) {
781
+ return true;
782
+ }
783
+ return false;
784
+ }
785
+
786
+ /**
787
+ * Detects a device running the Bada OS from Samsung.
788
+ * @return detection of a Bada device
789
+ */
790
+ public boolean detectBada() {
791
+ if (userAgent.indexOf(deviceBada) != -1) {
792
+ return true;
793
+ }
794
+ return false;
795
+ }
796
+
797
+ /**
798
+ * Detects a device running the Tizen smartphone OS.
799
+ * @return detection of a Tizen device
800
+ */
801
+ public boolean detectTizen() {
802
+ if (userAgent.indexOf(deviceTizen) != -1 &&
803
+ userAgent.indexOf(mobile) != -1) {
804
+ return true;
805
+ }
806
+ return false;
807
+ }
808
+
809
+ /**
810
+ * Detects if the current browser is on a Tizen smart TV.
811
+ * @return detection of a Tizen smart TV
812
+ */
813
+ public boolean detectTizenTV() {
814
+ if (userAgent.indexOf(deviceTizen) != -1 &&
815
+ userAgent.indexOf(smartTV1) != -1) {
816
+ return true;
817
+ }
818
+ return false;
819
+ }
820
+
821
+ /**
822
+ * Detects a device running the Meego OS.
823
+ * @return detection of a Meego device
824
+ */
825
+ public boolean detectMeego() {
826
+ if (userAgent.indexOf(deviceMeego) != -1) {
827
+ return true;
828
+ }
829
+ return false;
830
+ }
831
+
832
+ /**
833
+ * Detects a phone running the Meego OS.
834
+ * @return detection of a Meego phone
835
+ */
836
+ public boolean detectMeegoPhone() {
837
+ if (userAgent.indexOf(deviceMeego) != -1 &&
838
+ userAgent.indexOf(mobi) != -1) {
839
+ return true;
840
+ }
841
+ return false;
842
+ }
843
+
844
+ /**
845
+ * Detects a mobile device (probably) running the Firefox OS.
846
+ * @return detection of a Firefox OS mobile device
847
+ */
848
+ public boolean detectFirefoxOS() {
849
+ if (detectFirefoxOSPhone() || detectFirefoxOSTablet())
850
+ return true;
851
+
852
+ return false;
853
+ }
854
+
855
+ /**
856
+ * Detects a phone (probably) running the Firefox OS.
857
+ * @return detection of a Firefox OS phone
858
+ */
859
+ public boolean detectFirefoxOSPhone() {
860
+ //First, let's make sure we're NOT on another major mobile OS.
861
+ if (detectIos()
862
+ || detectAndroid()
863
+ || detectSailfish())
864
+ return false;
865
+
866
+ if ((userAgent.indexOf(engineFirefox) != -1)
867
+ && (userAgent.indexOf(mobile) != -1))
868
+ return true;
869
+
870
+ return false;
871
+ }
872
+
873
+ /**
874
+ * Detects a tablet (probably) running the Firefox OS.
875
+ * @return detection of a Firefox OS tablet
876
+ */
877
+ public boolean detectFirefoxOSTablet() {
878
+ //First, let's make sure we're NOT on another major mobile OS.
879
+ if (detectIos()
880
+ || detectAndroid()
881
+ || detectSailfish())
882
+ return false;
883
+
884
+ if ((userAgent.indexOf(engineFirefox) != -1)
885
+ && (userAgent.indexOf(deviceTablet) != -1))
886
+ return true;
887
+
888
+ return false;
889
+ }
890
+
891
+ /**
892
+ * Detects a device running the Sailfish OS.
893
+ * @return detection of a Sailfish device
894
+ */
895
+ public boolean detectSailfish() {
896
+ if (userAgent.indexOf(deviceSailfish) != -1) {
897
+ return true;
898
+ }
899
+ return false;
900
+ }
901
+
902
+ /**
903
+ * Detects a phone running the Sailfish OS.
904
+ * @return detection of a Sailfish phone
905
+ */
906
+ public boolean detectSailfishPhone() {
907
+ if (detectSailfish() && (userAgent.indexOf(mobile) != -1))
908
+ return true;
909
+
910
+ return false;
911
+ }
912
+
913
+ /**
914
+ * Detects a mobile device running the Ubuntu Mobile OS.
915
+ * @return detection of an Ubuntu Mobile OS mobile device
916
+ */
917
+ public boolean detectUbuntu() {
918
+ if (detectUbuntuPhone() || detectUbuntuTablet())
919
+ return true;
920
+
921
+ return false;
922
+ }
923
+
924
+ /**
925
+ * Detects a phone running the Ubuntu Mobile OS.
926
+ * @return detection of an Ubuntu Mobile OS phone
927
+ */
928
+ public boolean detectUbuntuPhone() {
929
+ if ((userAgent.indexOf(deviceUbuntu) != -1)
930
+ && (userAgent.indexOf(mobile) != -1))
931
+ return true;
932
+
933
+ return false;
934
+ }
935
+
936
+ /**
937
+ * Detects a tablet running the Ubuntu Mobile OS.
938
+ * @return detection of an Ubuntu Mobile OS tablet
939
+ */
940
+ public boolean detectUbuntuTablet() {
941
+ if ((userAgent.indexOf(deviceUbuntu) != -1)
942
+ && (userAgent.indexOf(deviceTablet) != -1))
943
+ return true;
944
+
945
+ return false;
946
+ }
947
+
948
+
949
+ /**
950
+ * Detects the Danger Hiptop device.
951
+ * @return detection of a Danger Hiptop
952
+ */
953
+ public boolean detectDangerHiptop() {
954
+ if (userAgent.indexOf(deviceDanger) != -1
955
+ || userAgent.indexOf(deviceHiptop) != -1) {
956
+ return true;
957
+ }
958
+ return false;
959
+ }
960
+
961
+ /**
962
+ * Detects if the current browser is a Sony Mylo device.
963
+ * @return detection of a Sony Mylo device
964
+ */
965
+ public boolean detectSonyMylo() {
966
+ if (userAgent.indexOf(manuSony) != -1
967
+ && (userAgent.indexOf(qtembedded) != -1
968
+ || userAgent.indexOf(mylocom2) != -1)) {
969
+ return true;
970
+ }
971
+ return false;
972
+ }
973
+
974
+ /**
975
+ * Detects if the current device is on one of the Maemo-based Nokia Internet Tablets.
976
+ * @return detection of a Maemo OS tablet
977
+ */
978
+ public boolean detectMaemoTablet() {
979
+ if (userAgent.indexOf(maemo) != -1) {
980
+ return true;
981
+ } else if (userAgent.indexOf(linux) != -1
982
+ && userAgent.indexOf(deviceTablet) != -1
983
+ && !detectWebOSTablet()
984
+ && !detectAndroid()) {
985
+ return true;
986
+ }
987
+ return false;
988
+ }
989
+
990
+ /**
991
+ * Detects if the current device is an Archos media player/Internet tablet.
992
+ * @return detection of an Archos media player
993
+ */
994
+ public boolean detectArchos() {
995
+ if (userAgent.indexOf(deviceArchos) != -1) {
996
+ return true;
997
+ }
998
+ return false;
999
+ }
1000
+
1001
+ /**
1002
+ * Detects if the current device is an Internet-capable game console.
1003
+ * Includes many handheld consoles.
1004
+ * @return detection of any Game Console
1005
+ */
1006
+ public boolean detectGameConsole() {
1007
+ if (detectSonyPlaystation()
1008
+ || detectNintendo()
1009
+ || detectXbox()) {
1010
+ return true;
1011
+ }
1012
+ return false;
1013
+ }
1014
+
1015
+ /**
1016
+ * Detects if the current device is a Sony Playstation.
1017
+ * @return detection of Sony Playstation
1018
+ */
1019
+ public boolean detectSonyPlaystation() {
1020
+ if (userAgent.indexOf(devicePlaystation) != -1) {
1021
+ return true;
1022
+ }
1023
+ return false;
1024
+ }
1025
+
1026
+ /**
1027
+ * Detects if the current device is a handheld gaming device with
1028
+ * a touchscreen and modern iPhone-class browser. Includes the Playstation Vita.
1029
+ * @return detection of a handheld gaming device
1030
+ */
1031
+ public boolean detectGamingHandheld() {
1032
+ if ((userAgent.indexOf(devicePlaystation) != -1) &&
1033
+ (userAgent.indexOf(devicePlaystationVita) != -1)) {
1034
+ return true;
1035
+ }
1036
+ return false;
1037
+ }
1038
+
1039
+ /**
1040
+ * Detects if the current device is a Nintendo game device.
1041
+ * @return detection of Nintendo
1042
+ */
1043
+ public boolean detectNintendo() {
1044
+ if (userAgent.indexOf(deviceNintendo) != -1
1045
+ || userAgent.indexOf(deviceWii) != -1
1046
+ || userAgent.indexOf(deviceNintendoDs) != -1) {
1047
+ return true;
1048
+ }
1049
+ return false;
1050
+ }
1051
+
1052
+ /**
1053
+ * Detects if the current device is a Microsoft Xbox.
1054
+ * @return detection of Xbox
1055
+ */
1056
+ public boolean detectXbox() {
1057
+ if (userAgent.indexOf(deviceXbox) != -1) {
1058
+ return true;
1059
+ }
1060
+ return false;
1061
+ }
1062
+
1063
+ /**
1064
+ * Detects whether the device is a Brew-powered device.
1065
+ * @return detection of a Brew device
1066
+ */
1067
+ public boolean detectBrewDevice() {
1068
+ if (userAgent.indexOf(deviceBrew) != -1) {
1069
+ return true;
1070
+ }
1071
+ return false;
1072
+ }
1073
+
1074
+ /**
1075
+ * Detects whether the device supports WAP or WML.
1076
+ * @return detection of a WAP- or WML-capable device
1077
+ */
1078
+ public boolean detectWapWml() {
1079
+ if (httpAccept.indexOf(vndwap) != -1
1080
+ || httpAccept.indexOf(wml) != -1) {
1081
+ return true;
1082
+ }
1083
+ return false;
1084
+ }
1085
+
1086
+ /**
1087
+ * Detects if the current device supports MIDP, a mobile Java technology.
1088
+ * @return detection of a MIDP mobile Java-capable device
1089
+ */
1090
+ public boolean detectMidpCapable() {
1091
+ if (userAgent.indexOf(deviceMidp) != -1
1092
+ || httpAccept.indexOf(deviceMidp) != -1) {
1093
+ return true;
1094
+ }
1095
+ return false;
1096
+ }
1097
+
1098
+
1099
+
1100
+ //*****************************
1101
+ // Device Classes
1102
+ //*****************************
1103
+
1104
+ /**
1105
+ * Check to see whether the device is any device
1106
+ * in the 'smartphone' category.
1107
+ * @return detection of a general smartphone device
1108
+ */
1109
+ public boolean detectSmartphone() {
1110
+ //Exclude duplicates from TierIphone
1111
+ return (detectTierIphone()
1112
+ || detectS60OssBrowser()
1113
+ || detectSymbianOS()
1114
+ || detectWindowsMobile()
1115
+ || detectBlackBerry()
1116
+ || detectMeegoPhone()
1117
+ || detectPalmOS());
1118
+ }
1119
+
1120
+ /**
1121
+ * Detects if the current device is a mobile device.
1122
+ * This method catches most of the popular modern devices.
1123
+ * Excludes Apple iPads and other modern tablets.
1124
+ * @return detection of any mobile device using the quicker method
1125
+ */
1126
+ public boolean detectMobileQuick() {
1127
+ //Let's exclude tablets
1128
+ if (isTierTablet) {
1129
+ return false;
1130
+ }
1131
+ //Most mobile browsing is done on smartphones
1132
+ if (detectSmartphone()) {
1133
+ return true;
1134
+ }
1135
+
1136
+ //Catch-all for many mobile devices
1137
+ if (userAgent.indexOf(mobile) != -1) {
1138
+ return true;
1139
+ }
1140
+
1141
+ if (detectOperaMobile()) {
1142
+ return true;
1143
+ }
1144
+
1145
+ //We also look for Kindle devices
1146
+ if (detectKindle()
1147
+ || detectAmazonSilk()) {
1148
+ return true;
1149
+ }
1150
+
1151
+ if (detectWapWml()
1152
+ || detectMidpCapable()
1153
+ || detectBrewDevice()) {
1154
+ return true;
1155
+ }
1156
+
1157
+ if ((userAgent.indexOf(engineNetfront) != -1)
1158
+ || (userAgent.indexOf(engineUpBrowser) != -1)) {
1159
+ return true;
1160
+ }
1161
+
1162
+ return false;
1163
+ }
1164
+
1165
+ /**
1166
+ * The longer and more thorough way to detect for a mobile device.
1167
+ * Will probably detect most feature phones,
1168
+ * smartphone-class devices, Internet Tablets,
1169
+ * Internet-enabled game consoles, etc.
1170
+ * This ought to catch a lot of the more obscure and older devices, also --
1171
+ * but no promises on thoroughness!
1172
+ * @return detection of any mobile device using the more thorough method
1173
+ */
1174
+ public boolean detectMobileLong() {
1175
+ if (detectMobileQuick()
1176
+ || detectGameConsole()) {
1177
+ return true;
1178
+ }
1179
+
1180
+ if (detectDangerHiptop()
1181
+ || detectMaemoTablet()
1182
+ || detectSonyMylo()
1183
+ || detectArchos()) {
1184
+ return true;
1185
+ }
1186
+
1187
+ if ((userAgent.indexOf(devicePda) != -1) &&
1188
+ (userAgent.indexOf(disUpdate) < 0)) //no index found
1189
+ {
1190
+ return true;
1191
+ }
1192
+
1193
+ //Detect older phones from certain manufacturers and operators.
1194
+ if ((userAgent.indexOf(uplink) != -1)
1195
+ || (userAgent.indexOf(engineOpenWeb) != -1)
1196
+ || (userAgent.indexOf(manuSamsung1) != -1)
1197
+ || (userAgent.indexOf(manuSonyEricsson) != -1)
1198
+ || (userAgent.indexOf(manuericsson) != -1)
1199
+ || (userAgent.indexOf(svcDocomo) != -1)
1200
+ || (userAgent.indexOf(svcKddi) != -1)
1201
+ || (userAgent.indexOf(svcVodafone) != -1))
1202
+ {
1203
+ return true;
1204
+ }
1205
+
1206
+ return false;
1207
+ }
1208
+
1209
+ //*****************************
1210
+ // For Mobile Web Site Design
1211
+ //*****************************
1212
+
1213
+ /**
1214
+ * The quick way to detect for a tier of devices.
1215
+ * This method detects for the new generation of
1216
+ * HTML 5 capable, larger screen tablets.
1217
+ * Includes iPad, Android (e.g., Xoom), BB Playbook, WebOS, etc.
1218
+ * @return detection of any device in the Tablet Tier
1219
+ */
1220
+ public boolean detectTierTablet() {
1221
+ if (detectIpad()
1222
+ || detectAndroidTablet()
1223
+ || detectBlackBerryTablet()
1224
+ || detectFirefoxOSTablet()
1225
+ || detectUbuntuTablet()
1226
+ || detectWebOSTablet()) {
1227
+ return true;
1228
+ }
1229
+ return false;
1230
+ }
1231
+
1232
+ /**
1233
+ * The quick way to detect for a tier of devices.
1234
+ * This method detects for devices which can
1235
+ * display iPhone-optimized web content.
1236
+ * Includes iPhone, iPod Touch, Android, Windows Phone 7 and 8, BB10, WebOS, Playstation Vita, etc.
1237
+ * @return detection of any device in the iPhone/Android/Windows Phone/BlackBerry/WebOS Tier
1238
+ */
1239
+ public boolean detectTierIphone() {
1240
+ if (detectIphoneOrIpod()
1241
+ || detectAndroidPhone()
1242
+ || detectWindowsPhone()
1243
+ || detectBlackBerry10Phone()
1244
+ || (detectBlackBerryWebKit()
1245
+ && detectBlackBerryTouch())
1246
+ || detectPalmWebOS()
1247
+ || detectBada()
1248
+ || detectTizen()
1249
+ || detectFirefoxOSPhone()
1250
+ || detectSailfishPhone()
1251
+ || detectUbuntuPhone()
1252
+ || detectGamingHandheld()) {
1253
+ return true;
1254
+ }
1255
+ return false;
1256
+ }
1257
+
1258
+ /**
1259
+ * The quick way to detect for a tier of devices.
1260
+ * This method detects for devices which are likely to be capable
1261
+ * of viewing CSS content optimized for the iPhone,
1262
+ * but may not necessarily support JavaScript.
1263
+ * Excludes all iPhone Tier devices.
1264
+ * @return detection of any device in the 'Rich CSS' Tier
1265
+ */
1266
+ public boolean detectTierRichCss() {
1267
+ boolean result = false;
1268
+ //The following devices are explicitly ok.
1269
+ //Note: 'High' BlackBerry devices ONLY
1270
+ if (detectMobileQuick()) {
1271
+
1272
+ //Exclude iPhone Tier and e-Ink Kindle devices.
1273
+ if (!detectTierIphone() && !detectKindle()) {
1274
+
1275
+ //The following devices are explicitly ok.
1276
+ //Note: 'High' BlackBerry devices ONLY
1277
+ //Older Windows 'Mobile' isn't good enough for iPhone Tier.
1278
+ if (detectWebkit()
1279
+ || detectS60OssBrowser()
1280
+ || detectBlackBerryHigh()
1281
+ || detectWindowsMobile()
1282
+ || userAgent.indexOf(engineTelecaQ) != -1) {
1283
+ result= true;
1284
+ } // if detectWebkit()
1285
+ } //if !detectTierIphone()
1286
+ } //if detectMobileQuick()
1287
+ return result;
1288
+ }
1289
+
1290
+ /**
1291
+ * The quick way to detect for a tier of devices.
1292
+ * This method detects for all other types of phones,
1293
+ * but excludes the iPhone and RichCSS Tier devices.
1294
+ * @return detection of a mobile device in the less capable tier
1295
+ */
1296
+ public boolean detectTierOtherPhones() {
1297
+ //Exclude devices in the other 2 categories
1298
+ if (detectMobileLong()
1299
+ && !detectTierIphone()
1300
+ && !detectTierRichCss()) {
1301
+ return true;
1302
+ }
1303
+ return false;
1304
+ }
1305
+ }