Android Open Source - growthpush-android Device Utils






From Project

Back to project page growthpush-android.

License

The source code is released under:

Apache License

If you think the Android project growthpush-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.growthpush.utils;
//from   www. j  a v  a2  s  .  c o  m
import java.util.Locale;
import java.util.TimeZone;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;

/**
 * Created by Shigeru Ogawa on 13/08/12.
 */
public class DeviceUtils {

  public static String getDevice() {
    return Build.MODEL;
  }

  public static String getOs() {
    return "Android " + Build.VERSION.RELEASE;
  }

  public static String getLanguage() {
    return Locale.getDefault().getLanguage();
  }

  public static String getTimeZone() {
    return TimeZone.getDefault().getID();
  }

  public static String getVersion(Context context) {

    try {
      PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_META_DATA);
      return packageInfo.versionName;
    } catch (NameNotFoundException e) {
      return null;
    }

  }

  public static String getBuild(Context context) {

    try {
      PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_META_DATA);
      return String.valueOf(packageInfo.versionCode);
    } catch (NameNotFoundException e) {
      return null;
    }

  }
}




Java Source Code List

com.growthpush.BroadcastReceiver.java
com.growthpush.GrowthPushException.java
com.growthpush.GrowthPush.java
com.growthpush.Logger.java
com.growthpush.Preference.java
com.growthpush.Thread.java
com.growthpush.bridge.ExternalFrameworkBridge.java
com.growthpush.bridge.ExternalFrameworkBroadcastReceiver.java
com.growthpush.growthpushsample.MainActivity.java
com.growthpush.handler.BaseReceiveHandler.java
com.growthpush.handler.DefaultReceiveHandler.java
com.growthpush.handler.OnlyAlertReceiveHandler.java
com.growthpush.handler.OnlyNotificationReceiveHandler.java
com.growthpush.handler.ReceiveHandler.java
com.growthpush.model.ClientStatus.java
com.growthpush.model.Client.java
com.growthpush.model.Environment.java
com.growthpush.model.Error.java
com.growthpush.model.Event.java
com.growthpush.model.Model.java
com.growthpush.model.Tag.java
com.growthpush.utils.DeviceUtils.java
com.growthpush.utils.IOUtils.java
com.growthpush.utils.PermissionUtils.java
com.growthpush.utils.SystemUtils.java
com.growthpush.view.AlertActivity.java
com.growthpush.view.AlertFragment.java
com.growthpush.view.DialogCallback.java