You are here

function hook_detect_mobile_device in Mobile Tools 6.2

Detect mobile devices.

This hook can be used to implement custom mobile device detection. Custom detection methods will be displayed and made selectable on the Mobile Tools administration page.

2 functions implement hook_detect_mobile_device()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

mobile_tools_detection_detect_mobile_device in modules/mobile_tools_detection/mobile_tools_detection.module
Implementation of hook_detect_mobile_device().
mt_browscap_detect_mobile_device in modules/mt_browscap/mt_browscap.module
Implementatation of hook_detect_mobile_device().
2 invocations of hook_detect_mobile_device()
mobile_tools_external_modules_configuration_form in ./mobile_tools.admin.inc
Configuration of external modules
mobile_tools_is_mobile_device in ./mobile_tools.module
Determine if the current user agent represents a mobile device.

File

./mobile_tools.api.php, line 58
Hooks provided by the Mobile Tools module.

Code

function hook_detect_mobile_device() {

  // Assume the device is a desktop until we can prove otherwise
  $type = 'Desktop';
  $group = '';

  // Implement some sort of algorithm to determine the properties of the device
  $device_properties = custom_detection_algorithm();

  // Examine the properties of the device to determine if it is mobile and if
  // belongs to a certain 'family' of devices
  if ($device_properties['is_mobile'] == TRUE) {
    $device_type = 'mobile';
  }
  if ($device_properties['device_family'] == 'iphone' || $device_properties['device_family'] == 'ipad') {
    $group = 'apple';
  }
  return array(
    'type' => $type,
    'group' => $group,
  );
}