Package com.eclipsesource.tabris.internal

Source Code of com.eclipsesource.tabris.internal.DeviceUtil

/*******************************************************************************
* Copyright (c) 2013 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*    EclipseSource - initial API and implementation
******************************************************************************/
package com.eclipsesource.tabris.internal;

import org.eclipse.rap.rwt.RWT;

import com.eclipsesource.tabris.ClientDevice.Platform;


public class DeviceUtil {

  public static Platform getPlatform() {
    String userAgent = RWT.getRequest().getHeader( Constants.USER_AGENT );
    Platform result = Platform.WEB;
    if( userAgent != null && userAgent.contains( Constants.ID_IOS ) ) {
      result = Platform.IOS;
    } else if( userAgent != null && userAgent.contains( Constants.ID_ANDROID ) ) {
      result = Platform.ANDROID;
    }
    return result;
  }

  private DeviceUtil() {
    // prevent instantiation
  }
}
TOP

Related Classes of com.eclipsesource.tabris.internal.DeviceUtil

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.