Asked  7 Months ago    Answers:  5   Viewed   32 times

I tried to search in google but cannot find a complete solution (i only find something detects only the browser's type like firefox, opera) .

i want a php class or code to check the user's Browser including the version and also the operating system.




I used the one and they don't always update it and it use procedural code which feel dated...

The Wolfcast BrowserDetection PHP class is updated and use an Object-Oriented way to do it:

You use it this way:

$browser = new BrowserDetection();
echo 'You are using ', $browser->getBrowser(), ' version ', $browser->getVersion();

Another example:

$browser = new BrowserDetection();
if ($browser->getBrowser() == BrowserDetection::BROWSER_FIREFOX && $browser->compareVersions($browser->getVersion(), '5.0.1') !== 1) {
    echo 'You have FireFox version 5.0.1 or greater. ';
Wednesday, March 31, 2021
answered 7 Months ago

You should point to your vendor/autoload.php at Settings | PHP | PHPUnit when using PHPUnit via Composer.

This blog post has all the details (with pictures) to successfully configure IDE for such scenario:

Related usability ticket:

P.S. The WI-18388 ticket is already fixed in v8.0

Wednesday, March 31, 2021
answered 7 Months ago

On Mac OS X environment variables available in Terminal and for the normal applications can be different, check the related question for the solution how to make them similar.

Note that this solution will not work on Mountain Lion (10.8).

Saturday, May 29, 2021
answered 5 Months ago

You can test the user agent string:

 * Determine the mobile operating system.
 * This function returns one of 'iOS', 'Android', 'Windows Phone', or 'unknown'.
 * @returns {String}
function getMobileOperatingSystem() {
  var userAgent = navigator.userAgent || navigator.vendor || window.opera;

      // Windows Phone must come first because its UA also contains "Android"
    if (/windows phone/i.test(userAgent)) {
        return "Windows Phone";

    if (/android/i.test(userAgent)) {
        return "Android";

    // iOS detection from:
    if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
        return "iOS";

    return "unknown";
Sunday, June 6, 2021
answered 5 Months ago

sorry for being mr.Obvious, but it seems that isn't your best friend...

Anyways, lets be constructive:

1.) You can use the MapBox SDK. Here is the link where is an example on how to use the online map. Now, that isn't of much use for the offline maps, but in there you can find the SDK. Just download it, and in there you can find also a test app where you can find out how the guys did it.

I beleive there must be an easier way to install the library, but I had to import lots of new stuff to make this work. Also, be careful to get latest library jar's since I had okhttp-urlconnection-2.0.0.jar and the app crashed upon showing the view. And then I found out that I needed version 2.1.0 jar.

2.) For offline map import I found this link helpful as it offers bits of code that eased my suffering to show the map properly. In case the link dies code states:

To start create, for example, a method called setupMaboxOffline() in your WearActivity:

public void setupMaboxOffline() {
    MapView mapView = (MapView) findViewById(;
    mapView.setCenter(new LatLng(38.8977, -77.0365));
    mapView.setTileSource(new MBTilesLayer(this, "control-room-0.2.0.mbtiles"));

Then, call it within the WatchViewStub in onCreate(). This stub is used by Android Wear to choose the right layout (round or square) depending on the shape of the watch the user has.

The MapView referenced above looks like this (in both layouts):

    android:layout_height="fill_parent" />

In case you'd need mapbox id property in the xml this SO question gets the answer.

Basically, as I've only displayed the map, this is fairly simple... You need your .mbtiles file inside assets folder. Library needs to be showing no errors ;). In your xml file you've put the MapView custom view.

Then in your Activity:

MapView mapView = (MapView) findViewById(;
mapView.setTileSource(new MBTilesLayer(this, "map.mbtiles"));

You can then add your custom settings like zoom and stuff.

Good luck with your offline map. :)

Friday, August 20, 2021
Xi Sigma
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :