Example usage for android.os Build MODEL

List of usage examples for android.os Build MODEL

Introduction

In this page you can find the example usage for android.os Build MODEL.

Prototype

String MODEL

To view the source code for android.os Build MODEL.

Click Source Link

Document

The end-user-visible name for the end product.

Usage

From source file:com.hoccer.api.android.AsyncLinccer.java

public static String getUserNameFromSharedPreferences(Context context) {
    SharedPreferences prefs = context.getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE);

    String defaultValue = "<" + Build.MODEL + ">";
    String clientName = prefs.getString("client_name", defaultValue);

    if (defaultValue.equals(clientName)) {
        SharedPreferences.Editor editor = prefs.edit();
        editor.putString("client_name", defaultValue);
        editor.commit();/* w  w  w. j a  v a 2 s.  c o m*/
    }
    return clientName;
}

From source file:at.alladin.rmbt.android.util.InformationCollector.java

private void getClientInfo() {
    final String tmpuuid = ConfigHelper.getUUID(context);

    if (tmpuuid == null || tmpuuid.length() == 0)
        fullInfo.setProperty("UUID", "");
    else/*from  www  . j a va 2  s.co  m*/
        fullInfo.setProperty("UUID", tmpuuid);

    fullInfo.setProperty("PLATTFORM", PLATTFORM_NAME);

    fullInfo.setProperty("OS_VERSION",
            android.os.Build.VERSION.RELEASE + "(" + android.os.Build.VERSION.INCREMENTAL + ")");

    fullInfo.setProperty("API_LEVEL", String.valueOf(android.os.Build.VERSION.SDK_INT));

    fullInfo.setProperty("DEVICE", android.os.Build.DEVICE);

    fullInfo.setProperty("MODEL", android.os.Build.MODEL);

    fullInfo.setProperty("PRODUCT", android.os.Build.PRODUCT);

    fullInfo.setProperty("NETWORK_TYPE", String.valueOf(getNetwork()));

    if (connManager != null) {
        final NetworkInfo activeNetworkInfo = connManager.getActiveNetworkInfo();
        if (activeNetworkInfo != null)
            fullInfo.setProperty("TELEPHONY_NETWORK_IS_ROAMING", String.valueOf(activeNetworkInfo.isRoaming()));
    }

    PackageInfo pInfo;
    String clientVersion = "";
    try {
        pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
        clientVersion = pInfo.versionName;
    } catch (final NameNotFoundException e) {
        // e1.printStackTrace();
        Log.e(DEBUG_TAG, "version of the application cannot be found", e);
    }

    fullInfo.setProperty("CLIENT_NAME", Config.RMBT_CLIENT_NAME);
    fullInfo.setProperty("CLIENT_SOFTWARE_VERSION", clientVersion);
}

From source file:com.sidekickApp.AppState.java

public AppState() {
    mapCentered = false;/*ww w  .j  a  va  2 s . c o m*/
    currentApiVersion = android.os.Build.VERSION.SDK_INT;
    froyoApiVersion = android.os.Build.VERSION_CODES.FROYO;
    deviceMakeModel = Build.MANUFACTURER + " " + Build.MODEL;

    log("currentApiVersion = " + currentApiVersion + ", froyoApiVersion = " + froyoApiVersion
            + ", deviceMakeModel = " + deviceMakeModel);

    String prefix = "http";
    String suffix = ":";

    //represents ApiLevel 8, Android 2.2 & below = deprecation town
    /*
    if(currentApiVersion > froyoApiVersion)
    {
       // We can connect over https
       IS_SECURE = true;
       prefix += "s";
       suffix += "8081/";
    }
    else
    {
       // Cannot connect over https.
    */ IS_SECURE = false;
    suffix += "8080/";
    //}
    prefix += "://";

    devSocketUrl = prefix + devSocketUrl + suffix;
    devWebUrl = prefix + devWebUrl;
    productionSocketUrl = prefix + productionSocketUrl + suffix;
    productionWebUrl = prefix + productionWebUrl;
}

From source file:com.www.avtovokzal.org.MainActivity.java

private void sendPhoneInformationToServer() {
    String version = null;// w w w . jav  a  2s  .  c om
    PackageInfo packageInfo = null;

    try {
        packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }

    String manufacturer = Uri.encode(Build.MANUFACTURER);
    String model = Uri.encode(Build.MODEL);
    String device = Uri.encode(Build.DEVICE);
    String board = Uri.encode(Build.BOARD);
    String brand = Uri.encode(Build.BRAND);
    String display = Uri.encode(Build.DISPLAY);
    String id = Uri.encode(Build.ID);
    String product = Uri.encode(Build.PRODUCT);
    String release = Uri.encode(Build.VERSION.RELEASE);

    if (packageInfo != null) {
        version = Uri.encode(packageInfo.versionName);
    }

    if (Constants.LOG_ON) {
        Log.v(TAG, "1: " + manufacturer + " 2: " + model + " 3: " + device + " 4: " + board + " 5: " + brand
                + " 6: " + display + " 7: " + id + " 8: " + product + " 9: " + release + " 10: " + version);
    }

    String url = "http://www.avtovokzal.org/php/app/sendPhoneInformation.php?manufacturer=" + manufacturer
            + "&model=" + model + "&device=" + device + "&board=" + board + "&brand=" + brand + "&display="
            + display + "&build_id=" + id + "&product=" + product + "&release_number=" + release + "&version="
            + version;

    if (isOnline()) {
        StringRequest strReq = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                if (Constants.LOG_ON)
                    VolleyLog.d(TAG, "Error: " + error.getMessage());
            }
        });
        // ? TimeOut, Retry
        strReq.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS, 3,
                DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
        // ? ?  
        AppController.getInstance().addToRequestQueue(strReq);
    } else {
        callErrorActivity();
    }
}

From source file:org.opendatakit.survey.activities.MediaCaptureVideoActivity.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {

    if (resultCode == Activity.RESULT_CANCELED) {
        // request was canceled -- propagate
        setResult(Activity.RESULT_CANCELED);
        finish();/*from  ww w.j a va2  s. c om*/
        return;
    }

    Uri mediaUri = intent.getData();

    // it is unclear whether getData() always returns a value or if
    // getDataString() does...
    String str = intent.getDataString();
    if (mediaUri == null && str != null) {
        WebLogger.getLogger(appName).w(t, "Attempting to work around null mediaUri");
        mediaUri = Uri.parse(str);
    }

    if (mediaUri == null) {
        // we are in trouble
        WebLogger.getLogger(appName).e(t, "No uri returned from ACTION_CAPTURE_VIDEO!");
        setResult(Activity.RESULT_CANCELED);
        finish();
        return;
    }

    // Remove the current media.
    deleteMedia();

    // get the file path and create a copy in the instance folder
    String binaryPath = MediaUtils.getPathFromUri(this, (Uri) mediaUri, Video.Media.DATA);
    File source = new File(binaryPath);
    String extension = binaryPath.substring(binaryPath.lastIndexOf("."));

    if (uriFragmentToMedia == null) {
        // use the newFileBase as a starting point...
        uriFragmentToMedia = uriFragmentNewFileBase + extension;
    }

    // adjust the mediaPath (destination) to have the same extension
    // and delete any existing file.
    File f = ODKFileUtils.getRowpathFile(appName, tableId, instanceId, uriFragmentToMedia);
    File sourceMedia = new File(f.getParentFile(),
            f.getName().substring(0, f.getName().lastIndexOf('.')) + extension);
    uriFragmentToMedia = ODKFileUtils.asRowpathUri(appName, tableId, instanceId, sourceMedia);
    deleteMedia();

    try {
        FileUtils.copyFile(source, sourceMedia);
    } catch (IOException e) {
        WebLogger.getLogger(appName).e(t, ERROR_COPY_FILE + sourceMedia.getAbsolutePath());
        Toast.makeText(this, R.string.media_save_failed, Toast.LENGTH_SHORT).show();
        deleteMedia();
        setResult(Activity.RESULT_CANCELED);
        finish();
        return;
    }

    if (sourceMedia.exists()) {
        // Add the copy to the content provier
        ContentValues values = new ContentValues(6);
        values.put(Video.Media.TITLE, sourceMedia.getName());
        values.put(Video.Media.DISPLAY_NAME, sourceMedia.getName());
        values.put(Video.Media.DATE_ADDED, System.currentTimeMillis());
        values.put(Video.Media.DATA, sourceMedia.getAbsolutePath());

        Uri MediaURI = getApplicationContext().getContentResolver().insert(Video.Media.EXTERNAL_CONTENT_URI,
                values);
        WebLogger.getLogger(appName).i(t, "Inserting VIDEO returned uri = " + MediaURI.toString());
        uriFragmentToMedia = ODKFileUtils.asRowpathUri(appName, tableId, instanceId, sourceMedia);
        WebLogger.getLogger(appName).i(t, "Setting current answer to " + sourceMedia.getAbsolutePath());

        // Need to have this ugly code to account for 
        // a bug in the Nexus 7 on 4.3 not returning the mediaUri in the data
        // of the intent - uri in this case is a file 
        int delCount = 0;
        if (NEXUS7.equals(android.os.Build.MODEL) && Build.VERSION.SDK_INT == 18) {
            File fileToDelete = new File(mediaUri.getPath());
            delCount = fileToDelete.delete() ? 1 : 0;
        } else {
            delCount = getApplicationContext().getContentResolver().delete(mediaUri, null, null);
        }
        WebLogger.getLogger(appName).i(t,
                "Deleting original capture of file: " + mediaUri.toString() + " count: " + delCount);
    } else {
        WebLogger.getLogger(appName).e(t, "Inserting Video file FAILED");
    }

    /*
     * We saved the audio to the instance directory. Verify that it is there...
     */
    returnResult();
    return;
}

From source file:org.akvo.caddisfly.helper.TestConfigHelper.java

private static JSONObject getDeviceDetails() throws JSONException {
    JSONObject details = new JSONObject();
    details.put("model", Build.MODEL);
    details.put("product", Build.PRODUCT);
    details.put("manufacturer", Build.MANUFACTURER);
    details.put("os", "Android - " + Build.VERSION.RELEASE + " (" + Build.VERSION.SDK_INT + ")");
    details.put("country", Locale.getDefault().getCountry());
    details.put("language", Locale.getDefault().getLanguage());
    return details;
}

From source file:org.woltage.irssiconnectbot.ConsoleActivity.java

@Override
@TargetApi(11)/* w  ww  .  j av a  2 s.co m*/
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    if (!InstallMosh.isInstallStarted()) {
        new InstallMosh(this);
    }

    configureStrictMode();
    hardKeyboard = getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY;

    hardKeyboard = hardKeyboard && !Build.MODEL.contains("Transformer");

    this.setContentView(R.layout.act_console);
    BugSenseHandler.setup(this, "d27a12dc");

    clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
    prefs = PreferenceManager.getDefaultSharedPreferences(this);

    // hide action bar if requested by user
    try {
        ActionBar actionBar = getActionBar();
        if (!prefs.getBoolean(PreferenceConstants.ACTIONBAR, true)) {
            actionBar.hide();
        }
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
    } catch (NoSuchMethodError error) {
        Log.w(TAG, "Android sdk version pre 11. Not touching ActionBar.");
    }

    // hide status bar if requested by user
    if (prefs.getBoolean(PreferenceConstants.FULLSCREEN, false)) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    // TODO find proper way to disable volume key beep if it exists.
    setVolumeControlStream(AudioManager.STREAM_MUSIC);

    // handle requested console from incoming intent
    requested = getIntent().getData();

    inflater = LayoutInflater.from(this);

    flip = (ViewFlipper) findViewById(R.id.console_flip);
    empty = (TextView) findViewById(android.R.id.empty);

    stringPromptGroup = (RelativeLayout) findViewById(R.id.console_password_group);
    stringPromptInstructions = (TextView) findViewById(R.id.console_password_instructions);
    stringPrompt = (EditText) findViewById(R.id.console_password);
    stringPrompt.setOnKeyListener(new OnKeyListener() {
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (event.getAction() == KeyEvent.ACTION_UP)
                return false;
            if (keyCode != KeyEvent.KEYCODE_ENTER)
                return false;

            // pass collected password down to current terminal
            String value = stringPrompt.getText().toString();

            PromptHelper helper = getCurrentPromptHelper();
            if (helper == null)
                return false;
            helper.setResponse(value);

            // finally clear password for next user
            stringPrompt.setText("");
            updatePromptVisible();

            return true;
        }
    });

    booleanPromptGroup = (RelativeLayout) findViewById(R.id.console_boolean_group);
    booleanPrompt = (TextView) findViewById(R.id.console_prompt);

    booleanYes = (Button) findViewById(R.id.console_prompt_yes);
    booleanYes.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            PromptHelper helper = getCurrentPromptHelper();
            if (helper == null)
                return;
            helper.setResponse(Boolean.TRUE);
            updatePromptVisible();
        }
    });

    booleanNo = (Button) findViewById(R.id.console_prompt_no);
    booleanNo.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            PromptHelper helper = getCurrentPromptHelper();
            if (helper == null)
                return;
            helper.setResponse(Boolean.FALSE);
            updatePromptVisible();
        }
    });

    // preload animations for terminal switching
    slide_left_in = AnimationUtils.loadAnimation(this, R.anim.slide_left_in);
    slide_left_out = AnimationUtils.loadAnimation(this, R.anim.slide_left_out);
    slide_right_in = AnimationUtils.loadAnimation(this, R.anim.slide_right_in);
    slide_right_out = AnimationUtils.loadAnimation(this, R.anim.slide_right_out);

    fade_out_delayed = AnimationUtils.loadAnimation(this, R.anim.fade_out_delayed);
    fade_stay_hidden = AnimationUtils.loadAnimation(this, R.anim.fade_stay_hidden);

    // Preload animation for keyboard button
    keyboard_fade_in = AnimationUtils.loadAnimation(this, R.anim.keyboard_fade_in);
    keyboard_fade_out = AnimationUtils.loadAnimation(this, R.anim.keyboard_fade_out);

    inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

    final RelativeLayout keyboardGroup = (RelativeLayout) findViewById(R.id.keyboard_group);

    if (Build.MODEL.contains("Transformer")
            && getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY
            && prefs.getBoolean(PreferenceConstants.ACTIONBAR, true)) {
        keyboardGroup.setEnabled(false);
        keyboardGroup.setVisibility(View.INVISIBLE);
    }

    mKeyboardButton = (ImageView) findViewById(R.id.button_keyboard);
    mKeyboardButton.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            View flip = findCurrentView(R.id.console_flip);
            if (flip == null)
                return;

            inputManager.showSoftInput(flip, InputMethodManager.SHOW_FORCED);
            keyboardGroup.setVisibility(View.GONE);
        }
    });

    final ImageView symButton = (ImageView) findViewById(R.id.button_sym);
    symButton.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            View flip = findCurrentView(R.id.console_flip);
            if (flip == null)
                return;

            TerminalView terminal = (TerminalView) flip;

            TerminalKeyListener handler = terminal.bridge.getKeyHandler();
            handler.showCharPickerDialog(terminal);
            keyboardGroup.setVisibility(View.GONE);
        }
    });

    mInputButton = (ImageView) findViewById(R.id.button_input);
    mInputButton.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            View flip = findCurrentView(R.id.console_flip);
            if (flip == null)
                return;

            final TerminalView terminal = (TerminalView) flip;
            Thread promptThread = new Thread(new Runnable() {
                public void run() {
                    String inj = getCurrentPromptHelper().requestStringPrompt(null, "");
                    terminal.bridge.injectString(inj);
                }
            });
            promptThread.setName("Prompt");
            promptThread.setDaemon(true);
            promptThread.start();

            keyboardGroup.setVisibility(View.GONE);
        }
    });

    final ImageView ctrlButton = (ImageView) findViewById(R.id.button_ctrl);
    ctrlButton.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            View flip = findCurrentView(R.id.console_flip);
            if (flip == null)
                return;
            TerminalView terminal = (TerminalView) flip;

            TerminalKeyListener handler = terminal.bridge.getKeyHandler();
            handler.metaPress(TerminalKeyListener.META_CTRL_ON);
            terminal.bridge.tryKeyVibrate();

            keyboardGroup.setVisibility(View.GONE);
        }
    });

    final ImageView escButton = (ImageView) findViewById(R.id.button_esc);
    escButton.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            View flip = findCurrentView(R.id.console_flip);
            if (flip == null)
                return;
            TerminalView terminal = (TerminalView) flip;

            TerminalKeyListener handler = terminal.bridge.getKeyHandler();
            handler.sendEscape();
            terminal.bridge.tryKeyVibrate();
            keyboardGroup.setVisibility(View.GONE);
        }
    });

    // detect fling gestures to switch between terminals
    final GestureDetector detect = new GestureDetector(new ICBSimpleOnGestureListener(this));

    flip.setLongClickable(true);
    flip.setOnTouchListener(new ICBOnTouchListener(this, keyboardGroup, detect));

}

From source file:com.stfalcon.contentmanager.ContentManager.java

/**
 * Check device model and return is need to set predefined camera uri
 *//*  ww w  .ja  v a  2s . c  o m*/
private boolean isSetPreDefinedCameraUri() {
    boolean setPreDefinedCameraUri = false;

    // NOTE: Do NOT SET: intent.putExtra(MediaStore.EXTRA_OUTPUT, cameraPicUri)
    // on Samsung Galaxy S2/S3/.. for the following reasons:
    // 1.) it will break the correct picture orientation
    // 2.) the photo will be stored in two locations (the given path and, additionally, in the MediaStore)
    String manufacturer = Build.MANUFACTURER.toLowerCase(Locale.ENGLISH);
    String model = Build.MODEL.toLowerCase(Locale.ENGLISH);
    String buildType = Build.TYPE.toLowerCase(Locale.ENGLISH);
    String buildDevice = Build.DEVICE.toLowerCase(Locale.ENGLISH);
    String buildId = Build.ID.toLowerCase(Locale.ENGLISH);
    //            String sdkVersion = android.os.Build.VERSION.RELEASE.toLowerCase(Locale.ENGLISH);

    if (!(manufacturer.contains("samsung")) && !(manufacturer.contains("sony"))) {
        setPreDefinedCameraUri = true;
    }
    if (manufacturer.contains("samsung") && model.contains("galaxy nexus")) { //TESTED
        setPreDefinedCameraUri = true;
    }
    if (manufacturer.contains("samsung") && model.contains("gt-n7000") && buildId.contains("imm76l")) { //TESTED
        setPreDefinedCameraUri = true;
    }

    if (buildType.contains("userdebug") && buildDevice.contains("ariesve")) { //TESTED
        setPreDefinedCameraUri = true;
    }
    if (buildType.contains("userdebug") && buildDevice.contains("crespo")) { //TESTED
        setPreDefinedCameraUri = true;
    }
    if (buildType.contains("userdebug") && buildDevice.contains("gt-i9100")) { //TESTED
        setPreDefinedCameraUri = true;
    }

    ///////////////////////////////////////////////////////////////////////////
    // TEST
    if (manufacturer.contains("samsung") && model.contains("sgh-t999l")) { //T-Mobile LTE enabled Samsung S3
        setPreDefinedCameraUri = true;
    }
    if (buildDevice.contains("cooper")) {
        setPreDefinedCameraUri = true;
    }
    if (buildType.contains("userdebug") && buildDevice.contains("t0lte")) {
        setPreDefinedCameraUri = true;
    }
    if (buildType.contains("userdebug") && buildDevice.contains("kot49h")) {
        setPreDefinedCameraUri = true;
    }
    if (buildType.contains("userdebug") && buildDevice.contains("t03g")) {
        setPreDefinedCameraUri = true;
    }
    if (buildType.contains("userdebug") && buildDevice.contains("gt-i9300")) {
        setPreDefinedCameraUri = true;
    }
    if (buildType.contains("userdebug") && buildDevice.contains("gt-i9195")) {
        setPreDefinedCameraUri = true;
    }
    if (buildType.contains("userdebug") && buildDevice.contains("xperia u")) {
        setPreDefinedCameraUri = true;
    }

    ///////////////////////////////////////////////////////////////////////////
    return setPreDefinedCameraUri;
}

From source file:com.ternup.caddisfly.fragment.ResultFragment.java

public void postResult(final String url) {

    RequestParams params = new RequestParams();
    TimeZone tz = TimeZone.getTimeZone("UTC");
    final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
    df.setTimeZone(tz);/*from  w w  w .  j a  v  a2  s. c om*/

    final ArrayList<String> filePaths = FileUtils.getFilePaths(getActivity(), folderName, "/small/",
            mLocationId);
    File myFile = new File(filePaths.get(0));
    String date = df.format(DateUtils.getDateFromFilename(myFile.getName()));

    params.put("date", date);
    String deviceId = Build.MANUFACTURER + " " + Build.MODEL;
    if (deviceId.length() > 32) {
        deviceId = deviceId.substring(1, 32);
    }
    params.put("deviceId", deviceId);
    params.put("type", String.valueOf(mTestTypeId + 1));

    if (wakeLock == null || !wakeLock.isHeld()) {
        PowerManager pm = (PowerManager) getActivity().getApplicationContext()
                .getSystemService(Context.POWER_SERVICE);
        wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP
                | PowerManager.ON_AFTER_RELEASE, "MyWakeLock");
        wakeLock.acquire();
    }

    WebClient.post("tests", params, new AsyncHttpResponseHandler() {
        @Override
        public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
            String response = responseBody == null ? null : new String(responseBody);
            try {
                JSONObject json = new JSONObject(response);
                final int newId = json.getInt("id");
                if (filePaths.size() > 0) {
                    count = 0;
                    totalCount = filePaths.size();
                    postItem(newId, filePaths);
                }

            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        @Override
        public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
            Log.d(Globals.DEBUG_TAG, "fail: " + error.getMessage());
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    if (progressDialog != null) {
                        progressDialog.dismiss();
                    }

                    if (wakeLock != null && wakeLock.isHeld()) {
                        wakeLock.release();
                    }
                }
            });

        }
    });
}

From source file:tw.com.sti.store.api.android.AndroidApiService.java

public List<NameValuePair> createRequestParams(String[] paramNames, String[] paramValues, boolean withToken,
        Integer appfilter, String userId, String pwd) {
    List<NameValuePair> nvps = new ArrayList<NameValuePair>();
    nvps.add(new BasicNameValuePair("store", storeId));
    nvps.add(new BasicNameValuePair("aver", sdkVer));
    nvps.add(new BasicNameValuePair("arel", sdkRel));
    nvps.add(new BasicNameValuePair("cver", clientVer));
    nvps.add(new BasicNameValuePair("lang", Locale.getDefault().toString()));
    TimeZone tz = TimeZone.getDefault();
    nvps.add(new BasicNameValuePair("tzid", tz.getID()));
    nvps.add(new BasicNameValuePair("tzrawoffset", "" + tz.getRawOffset()));
    String time = "" + System.currentTimeMillis();
    nvps.add(new BasicNameValuePair("time", time));
    String vstring = storeId + "|" + time;
    if (userId != null && pwd != null) {
        vstring = storeId + "|" + time + "|" + userId + "|" + pwd;
    } else if (withToken && this.credential.getToken() != null && this.credential.getToken().length() > 0) {
        vstring = storeId + "|" + time + "|" + this.credential.getToken();
    } else if (deviceId != null && subscriberId != null && simSerialNumber != null) {
        vstring = storeId + "|" + time + "|" + deviceId + "|" + subscriberId + "|" + simSerialNumber;
    }/* w  ww .  ja  va2s.c o  m*/
    L.d("vstring=" + vstring);
    String vsign = "";
    try {
        vsign = Dsa.sign(vstring, this.config.getApiPrivkey());
    } catch (Exception e) {

    }
    nvps.add(new BasicNameValuePair("vsign", vsign));
    nvps.add(new BasicNameValuePair("imei", deviceId));
    nvps.add(new BasicNameValuePair("mac", macAddress));
    nvps.add(new BasicNameValuePair("imsi", subscriberId));
    nvps.add(new BasicNameValuePair("iccid", simSerialNumber));
    nvps.add(new BasicNameValuePair("dvc", Build.MODEL));
    nvps.add(new BasicNameValuePair("wpx", wpx));
    nvps.add(new BasicNameValuePair("hpx", hpx));
    if (appfilter == null) {
        //?appFilter()
        nvps.add(new BasicNameValuePair("appfilter", "" + appFilter));
    } else {
        //?appfilter
        nvps.add(new BasicNameValuePair("appfilter", "" + appfilter));
    }

    //???
    if (this.config.getSnum() != null && this.config.getSnum().length() > 0) {
        nvps.add(new BasicNameValuePair("snum", this.config.getSnum()));
    }

    if (withToken && this.credential.getToken() != null && this.credential.getToken().length() > 0) {
        nvps.add(new BasicNameValuePair("token", this.credential.getToken()));
    }

    if (paramNames == null || paramValues == null) {
        return nvps;
    }

    if (paramNames.length != paramValues.length) {
        throw new IndexOutOfBoundsException("paramNames.length != paramValues.length");
    }

    int count = paramNames.length;
    for (int i = 0; i < count; i++) {
        nvps.add(new BasicNameValuePair(paramNames[i], paramValues[i]));
    }

    return nvps;
}