Example usage for android.util Log v

List of usage examples for android.util Log v

Introduction

In this page you can find the example usage for android.util Log v.

Prototype

public static int v(String tag, String msg) 

Source Link

Document

Send a #VERBOSE log message.

Usage

From source file:com.zegoggles.smssync.XOAuthConsumer.java

public String generateXOAuthString(final String username) {
    if (username == null)
        throw new IllegalArgumentException("username is null");

    try {/*from   w w w.j av a  2  s.co  m*/
        final URI uri = new URI(String.format("https://mail.google.com/mail/b/%s/imap/", urlEncode(username)));
        final HttpRequest request = wrap(new HttpGet(uri));
        final HttpParameters requestParameters = new HttpParameters();

        completeOAuthParameters(requestParameters);

        StringBuilder sasl = new StringBuilder().append("GET ").append(uri.toString()).append(" ");

        requestParameters.put("oauth_signature", generateSig(request, requestParameters), true);

        Iterator<Map.Entry<String, SortedSet<String>>> it = requestParameters.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry<String, SortedSet<String>> e = it.next();

            sasl.append(e.getKey()).append("=\"").append(e.getValue().iterator().next()).append("\"");

            if (it.hasNext()) {
                sasl.append(",");
            }
        }

        if (LOCAL_LOGV)
            Log.v(TAG, "sasl: " + sasl.toString());
        return base64(sasl.toString().getBytes(OAuth.ENCODING));
    } catch (URISyntaxException e) {
        throw new IllegalArgumentException(e);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:com.calebgomer.roadkill_reporter.AsyncReporter.java

public static void wakeUpServer(AsyncCallbackListener callback, Context context) {
    Log.v(TAG, "waking server");
    AsyncReporter.Payload request = new AsyncReporter.Payload(AsyncReporter.WAKE_UP_SERVER, null, callback,
            context);//w  w  w .jav a  2  s .co m
    AsyncReporter.perform(request);
}

From source file:de.electricdynamite.pasty.PastyClient.java

public JSONArray getClipboard() throws PastyException {
    String url = REST_SERVER_BASE_URL + REST_URI_CLIPBOARD;
    if (LOCAL_LOG)
        Log.v(TAG, "Starting REST call to API endpoint  " + url);
    StringBuilder builder = new StringBuilder();
    HttpClient client = new DefaultHttpClient();
    HttpGet httpGet = new HttpGet(url);

    try {/*from   ww w .jav a2s.  co m*/
        httpGet.setHeader("Authorization", getHTTPBasicAuth());
        httpGet.setHeader("Content-type", "application/json");
        httpGet.setHeader("User-Agent", httpUserAgent);
        System.setProperty("http.keepAlive", "false");
        HttpResponse response = client.execute(httpGet);
        StatusLine statusLine = response.getStatusLine();
        int statusCode = statusLine.getStatusCode();
        if (LOCAL_LOG)
            Log.v(TAG, "REST CALL finished with status " + statusCode);
        if (statusCode == 200) {
            HttpEntity entity = response.getEntity();
            InputStream content = entity.getContent();
            BufferedReader reader = new BufferedReader(new InputStreamReader(content));
            String line;
            while ((line = reader.readLine()) != null) {
                builder.append(line);
            }
            entity = null;
            content = null;
            reader = null;
            JSONObject jsonResponse = new JSONObject(builder.toString());
            JSONObject jsonPayload = jsonResponse.getJSONObject("payload");
            JSONArray jsonClipboard = jsonPayload.getJSONArray("items");
            builder = null;
            client = null;
            httpGet = null;
            response = null;
            statusLine = null;
            return jsonClipboard;
        } else if (statusCode == 401) {
            throw new PastyException(PastyException.ERROR_AUTHORIZATION_FAILED);
        } else {
            throw new PastyException(PastyException.ERROR_ILLEGAL_RESPONSE);
        }
    } catch (ClientProtocolException e) {
        e.printStackTrace();
        throw new PastyException(PastyException.ERROR_IO_EXCEPTION);
    } catch (IOException e) {
        e.printStackTrace();
        throw new PastyException(PastyException.ERROR_IO_EXCEPTION);
    } catch (JSONException e) {
        e.printStackTrace();
        throw new PastyException(PastyException.ERROR_ILLEGAL_RESPONSE);
    }
}

From source file:net.evecom.androidecssp.activity.ResponseListActivity.java

/**
 * //  w  w w.  j  a v  a 2s  .c  o m
 */
private void initlist() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            Message message = new Message();
            HashMap<String, String> hashMap = new HashMap<String, String>();
            hashMap.put("taskId", taskInfo.get("id").toString());
            try {
                resutArray = connServerForResultPost("jfs/ecssp/mobile/taskresponseCtr/getTaskResponseByTaskId",
                        hashMap);
            } catch (ClientProtocolException e) {
                message.what = MESSAGETYPE_02;
                Log.e("mars", e.getMessage());
            } catch (IOException e) {
                message.what = MESSAGETYPE_02;
                Log.e("mars", e.getMessage());
            }
            if (resutArray.length() > 0) {
                try {
                    taskResponseInfos = getObjsInfo(resutArray);
                    if (null == taskResponseInfos) {
                        message.what = MESSAGETYPE_02;
                    } else {
                        message.what = MESSAGETYPE_01;
                    }
                } catch (JSONException e) {
                    message.what = MESSAGETYPE_02;
                    Log.e("mars", e.getMessage());
                }
            } else {
                message.what = MESSAGETYPE_02;
            }
            Log.v("mars", resutArray);
            eventListHandler.sendMessage(message);

        }
    }).start();

}

From source file:com.phonegap.plugins.sqlitePlugin.SQLitePlugin.java

/**
 * Executes the request and returns PluginResult.
 *
 * @param action/*from  www .  j  av  a  2 s  .  c  o m*/
 *            The action to execute.
 * @param args
 *            JSONArry of arguments for the plugin.
 * @param callbackId
 *            The callback id used when calling back into JavaScript.
 * @return A PluginResult object with a status and message.
 */
public PluginResult execute(String action, JSONArray args, String callbackId) {
    PluginResult.Status status = PluginResult.Status.OK;
    String result = "";

    try {
        // TODO: Do we want to allow a user to do this, since they could get
        // to other app databases?
        if (action.equals("setStorage")) {
            this.setStorage(args.getString(0));
        } else if (action.equals("open")) {
            this.openDatabase(args.getString(0), "1", "database", 5000000);
            //this.openDatabase(args.getString(0), args.getString(1),
            //      args.getString(2), args.getLong(3));
        } else if (action.equals("executeSqlBatch")) {
            String[] queries = null;
            String[] queryIDs = null;
            String[][] params = null;
            String trans_id = null;
            JSONObject a = null;
            JSONArray jsonArr = null;
            int paramLen = 0;

            if (args.isNull(0)) {
                queries = new String[0];
            } else {
                int len = args.length();
                queries = new String[len];
                queryIDs = new String[len];
                params = new String[len][1];
                for (int i = 0; i < len; i++) {
                    a = args.getJSONObject(i);
                    queries[i] = a.getString("query");
                    queryIDs[i] = a.getString("query_id");
                    trans_id = a.getString("trans_id");
                    jsonArr = a.getJSONArray("params");
                    paramLen = jsonArr.length();
                    params[i] = new String[paramLen];

                    for (int j = 0; j < paramLen; j++) {
                        params[i][j] = jsonArr.getString(j);
                        if (params[i][j] == "null")
                            params[i][j] = "";
                    }
                }
            }
            if (trans_id != null)
                this.executeSqlBatch(queries, params, queryIDs, trans_id);
            else
                Log.v("error", "null trans_id");
        }
        return new PluginResult(status, result);
    } catch (JSONException e) {
        return new PluginResult(PluginResult.Status.JSON_EXCEPTION);
    }
}

From source file:com.pti.mates.ServerUtilities.java

public static void send2(String msg, String id, Context ctx) throws IOException {
    Log.v(LogConstants.LOG_SERVERUTILITIES, "Comencem send2");
    String serverUrl = Common.getServerUrl() + "/send";
    Log.v(LogConstants.LOG_SERVERUTILITIES, "URL = " + serverUrl);
    //Map<String, String> params = new HashMap<String, String>();
    //params.put("data", msg);
    Log.v(LogConstants.LOG_SERVERUTILITIES, "Missatge = " + msg);
    //params.put("id", id);       
    Log.v(LogConstants.LOG_SERVERUTILITIES, "ID = " + id);
    post2(serverUrl, msg, id, ctx);/*from   w w  w.  j a v  a2  s. c  om*/
}

From source file:com.coloreight.plugin.socialAuth.SocialAuth.java

@Override
protected void pluginInitialize() {
    super.pluginInitialize();

    FacebookSdk.sdkInitialize(this.cordova.getActivity().getApplicationContext());

    fbCallbackManager = CallbackManager.Factory.create();

    LoginManager.getInstance().registerCallback(fbCallbackManager, new FacebookCallback<LoginResult>() {
        @Override//w w  w .  j  av a  2 s.c  o  m
        public void onSuccess(LoginResult loginResult) {
            try {
                JSONObject json = new JSONObject();

                json.put("userId", loginResult.getAccessToken().getUserId());
                json.put("accessToken", loginResult.getAccessToken().getToken());
                json.put("hasWritePermissions",
                        loginResult.getAccessToken().getPermissions().contains("publish_actions"));

                PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, json);

                Log.v(TAG, "Facebook SDK auth success -> sended data: " + json.toString());
                callbackContext.sendPluginResult(pluginResult);
            } catch (JSONException e) {
                PluginResult pluginResult = new PluginResult(PluginResult.Status.ERROR,
                        e.getLocalizedMessage());

                callbackContext.sendPluginResult(pluginResult);
            }
        }

        @Override
        public void onCancel() {
            Log.v(TAG, "Facebook auth canceled");

            callbackContext.error("Facebook auth cancelled");
        }

        @Override
        public void onError(FacebookException exception) {
            if (exception instanceof FacebookAuthorizationException) {
                if (AccessToken.getCurrentAccessToken() != null) {
                    LoginManager.getInstance().logOut();
                }
            }

            Log.v(TAG, "Facebook auth error -> message:" + exception.getLocalizedMessage());

            callbackContext.error("Facebook auth error -> message:" + exception.getLocalizedMessage());
        }
    });
}

From source file:com.phonegap.plugin.files.ExtractZipFilePlugin.java

@Override
public boolean execute(String action, JSONArray args, CallbackContext cbc) {
    PluginResult.Status status = PluginResult.Status.OK;
    try {// ww  w .  j a  v  a  2 s  . c o  m
        String filename = args.getString(0);
        URL url;
        try {
            url = new URL(filename);
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
        File file = new File(url.getFile());
        String[] dirToSplit = url.getFile().split(File.separator);
        String dirToInsert = "";
        for (int i = 0; i < dirToSplit.length - 1; i++) {
            dirToInsert += dirToSplit[i] + File.separator;
        }

        ZipEntry entry;
        ZipFile zipfile;
        try {
            zipfile = new ZipFile(file);
            Enumeration e = zipfile.entries();
            while (e.hasMoreElements()) {
                entry = (ZipEntry) e.nextElement();
                BufferedInputStream is = null;
                try {
                    is = new BufferedInputStream(zipfile.getInputStream(entry));
                    int count;
                    byte data[] = new byte[102222];
                    String fileName = dirToInsert + entry.getName();
                    File outFile = new File(fileName);
                    if (entry.isDirectory()) {
                        if (!outFile.exists() && !outFile.mkdirs()) {
                            Log.v("info", "Unable to create directories: " + outFile.getAbsolutePath());
                            cbc.sendPluginResult(new PluginResult(IO_EXCEPTION));
                            return false;
                        }
                    } else {
                        File parent = outFile.getParentFile();
                        if (parent.mkdirs()) {
                            Log.v("info", "created directory leading to file");
                        }
                        FileOutputStream fos = null;
                        BufferedOutputStream dest = null;
                        try {
                            fos = new FileOutputStream(outFile);
                            dest = new BufferedOutputStream(fos, 102222);
                            while ((count = is.read(data, 0, 102222)) != -1) {
                                dest.write(data, 0, count);
                            }
                        } finally {
                            if (dest != null) {
                                dest.flush();
                                dest.close();
                            }
                            if (fos != null) {
                                fos.close();
                            }
                        }
                    }
                } finally {
                    if (is != null) {
                        is.close();
                    }
                }
            }
        } catch (ZipException e1) {
            Log.v("error", e1.getMessage(), e1);
            cbc.sendPluginResult(new PluginResult(MALFORMED_URL_EXCEPTION));
            return false;
        } catch (IOException e1) {
            Log.v("error", e1.getMessage(), e1);
            cbc.sendPluginResult(new PluginResult(IO_EXCEPTION));
            return false;
        }

    } catch (JSONException e) {
        cbc.sendPluginResult(new PluginResult(JSON_EXCEPTION));
        return false;
    }
    cbc.sendPluginResult(new PluginResult(status));
    return true;
}

From source file:com.sonymobile.android.media.internal.VUParser.java

public VUParser(String path, long offset, long length, int maxBufferSize) {
    super(path, offset, length, maxBufferSize);
    if (LOGS_ENABLED)
        Log.v(TAG, "create VUParser from path");
}

From source file:com.example.run_tracker.MyRunsFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    Log.v(TAG, "onCreateView");

    View rootView = inflater.inflate(R.layout.myrunfragment, container, false);

    listView = (ListView) rootView.findViewById(R.id.list);
    mRefresh = (Button) rootView.findViewById(R.id.refresh);
    listView.setOnItemClickListener(this);
    mMapFragment = CustomMapFragment.newInstance();
    getChildFragmentManager().beginTransaction().replace(R.id.map_container, mMapFragment).commit();
    mRefresh.setOnClickListener(this);
    return rootView;

}