Example usage for android.util Log i

List of usage examples for android.util Log i

Introduction

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

Prototype

public static int i(String tag, String msg) 

Source Link

Document

Send an #INFO log message.

Usage

From source file:org.intermine.app.net.request.JsonGetRequest.java

@Override
public T loadDataFromNetwork() throws Exception {
    Map<String, ?> params = getUrlParams();
    String uri = getUrl();/*from  w ww . jav  a 2s  .  com*/
    Gson mapper = getMapper();

    Log.i(TAG, "GET: " + expandQuery(uri, params));
    Log.i(TAG, "H: " + getHeaders());

    byte[] bytes = loadBytes(uri, params);
    T result = null;

    if (!ArrayUtils.isEmpty(bytes)) {
        String res = new String(bytes);
        Log.i(TAG, "RES: " + res);

        if (!Strs.isNullOrEmpty(mOutWrapper)) {
            Map<String, Object> rooted = mapper.fromJson(res, Map.class);
            String inner = mapper.toJson(rooted.get(mOutWrapper));

            result = mapper.fromJson(inner, getResultType());
        } else {
            result = mapper.fromJson(res, getResultType());
        }
    }

    Log.i(TAG, "RES: " + result);

    return result;
}

From source file:com.c77.androidstreamingclient.lib.video.DumpDecoder.java

@Override
public void decodeFrame(BufferedSample frame) {
    String debugging = "Size = " + frame.getSampleSize();
    debugging += " [" + new String(Hex.encodeHex(Arrays.copyOf(frame.getBuffer().array(), 16))) + "]";
    Log.i("DumpDecoder", debugging);
}

From source file:com.firsttry.mumbaiparking.helpers.AbstractGetNameTask.java

AbstractGetNameTask(GoogleLoginActivity activity, String email, String scope) {
    Log.i("Flow-AbstractGetNameTask", "AbstractGetNameTask constructor");
    this.mActivity = activity;
    this.mScope = scope;
    this.mEmail = email;
}

From source file:net.facework.core.streaming.misc.UriParser.java

public static void parse(String uri, Session session) throws IllegalStateException, IOException {
    boolean flash = false;
    int camera = CameraInfo.CAMERA_FACING_FRONT;
    Log.i("UriParser", "RTSP server received:" + uri);
    String[] uriItem = uri.split("/");
    filename = uriItem[uriItem.length - 1];

    List<NameValuePair> params = URLEncodedUtils.parse(URI.create(uri), "UTF-8");
    if (params.size() > 0) {

        // Those parameters must be parsed first or else they won't necessarily be taken into account
        for (Iterator<NameValuePair> it = params.iterator(); it.hasNext();) {
            NameValuePair param = it.next();
            // play file
            if (param.getName().equals("file")) {
                Log.i("UriParser", "file name:" + param.getValue());
                session.setFile(param.getValue());
                session.addFileVideoTrack(Session.FILE_VIDEO_H264);
                Log.i("UriParser", "RTSP work in FILE_VIDEO_H264 Mode. FILE:" + param.getValue());
                session.addFileAudioTrack(Session.FILE_AUDIO_AAC);
                Log.i("UriParser", "RTSP work in FILE_AUDIO_AAC Mode. FILE:" + param.getValue());
                session.setFileMode();//from   ww  w  .j  a  va  2s . c  om

                break;
            }
            // FLASH ON/OFF
            if (param.getName().equals("flash")) {
                if (param.getValue().equals("on"))
                    flash = true;
                else
                    flash = false;
            }

            // CAMERA -> the client can choose between the front facing camera and the back facing camera
            else if (param.getName().equals("camera")) {
                if (param.getValue().equals("back"))
                    camera = CameraInfo.CAMERA_FACING_BACK;
                else if (param.getValue().equals("front"))
                    camera = CameraInfo.CAMERA_FACING_FRONT;
            }

            // MULTICAST -> the stream will be sent to a multicast group
            // The default mutlicast address is 228.5.6.7, but the client can specify one 
            else if (param.getName().equals("multicast")) {
                session.setRoutingScheme(Session.MULTICAST);
                if (param.getValue() != null) {
                    try {
                        InetAddress addr = InetAddress.getByName(param.getValue());
                        if (!addr.isMulticastAddress()) {
                            throw new IllegalStateException("Invalid multicast address !");
                        }
                        session.setDestination(addr);
                    } catch (UnknownHostException e) {
                        throw new IllegalStateException("Invalid multicast address !");
                    }
                } else {
                    // Default multicast address
                    session.setDestination(InetAddress.getByName("228.5.6.7"));
                }
            }

            // UNICAST -> the client can use this so specify where he wants the stream to be sent
            else if (param.getName().equals("unicast")) {
                if (param.getValue() != null) {
                    try {
                        InetAddress addr = InetAddress.getByName(param.getValue());
                        session.setDestination(addr);
                    } catch (UnknownHostException e) {
                        throw new IllegalStateException("Invalid destination address !");
                    }
                }
            }

            // TTL -> the client can modify the time to live of packets
            // By default ttl=64
            else if (param.getName().equals("ttl")) {
                if (param.getValue() != null) {
                    try {
                        int ttl = Integer.parseInt(param.getValue());
                        if (ttl < 0)
                            throw new IllegalStateException("The TTL must be a positive integer !");
                        session.setTimeToLive(ttl);
                    } catch (Exception e) {
                        throw new IllegalStateException("The TTL must be a positive integer !");
                    }
                }
            }

            // No tracks will be added to the session
            else if (param.getName().equals("stop")) {
                return;
            }

        }

        for (Iterator<NameValuePair> it = params.iterator(); it.hasNext();) {
            NameValuePair param = it.next();

            // H264
            if (param.getName().equals("h264")) {
                VideoQuality quality = VideoQuality.parseQuality(param.getValue());
                session.addVideoTrack(Session.VIDEO_H264, camera, quality, flash);
            }

            // H263
            else if (param.getName().equals("h263")) {
                VideoQuality quality = VideoQuality.parseQuality(param.getValue());
                session.addVideoTrack(Session.VIDEO_H263, camera, quality, flash);
            }

            // AMRNB
            else if (param.getName().equals("amrnb") || param.getName().equals("amr")) {
                session.addAudioTrack(Session.AUDIO_AMRNB);
            }

            // AAC
            else if (param.getName().equals("aac")) {
                session.addAudioTrack(Session.AUDIO_AAC);
            }

            // Generic Audio Stream -> make use of api level 12
            // TODO: Doesn't work :/
            else if (param.getName().equals("testnewapi")) {
                session.addAudioTrack(Session.AUDIO_ANDROID_AMR);
            }

        }

        // The default behavior is to only add one video track
        if (session.getTrackCount() == 0) {
            session.addVideoTrack();
            session.addAudioTrack();
        }

    } else if (!filename.contains(":")) {
        if (filename.equals("h264.sdp")) {
            VideoQuality quality = VideoQuality.defaultVideoQualiy.clone();
            session.addVideoTrack(Session.VIDEO_H264, camera, quality, flash);
        } else {
            Log.i("UriParser", "file name:" + filename + ";");
            session.setFile(filename);
            session.addFileVideoTrack(Session.FILE_VIDEO_H264);
            Log.i("UriParser", "RTSP work in FILE_VIDEO_H264 Mode. FILE:" + filename);
            /*session.addFileAudioTrack(Session.FILE_AUDIO_AAC);
            Log.i("UriParser","RTSP work in FILE_AUDIO_AAC Mode. FILE:"+filename);*/
            session.setFileMode();
        }

    }
    // Uri has no parameters: the default behavior is to only add one video track
    else {
        session.addVideoTrack();
        session.addAudioTrack();
    }
}

From source file:com.grepsound.requests.GoogleLoginRequest.java

@Override
public Token loadDataFromNetwork() throws Exception {

    //        Request req = new Request("https://api.soundcloud.com/oauth2/token");

    HttpPost req = new HttpPost("https://api.soundcloud.com/oauth2/token");

    JSONObject body = new JSONObject();
    body.put("access_token", mGToken);
    body.put("scope", Token.SCOPE_NON_EXPIRING);

    ApiWrapper wrapper = new ApiWrapper(SpiceUpService.CLIENT_ID, SpiceUpService.CLIENT_SECRET, null, null);
    HttpClient client = wrapper.getHttpClient();

    HttpResponse response = client.execute(req);

    Log.i("G+REQUEST", response.getEntity().toString());

    return null;/*from  w w w.  j  a  v  a2 s  .c  o m*/
}

From source file:jp.co.ipublishing.aeskit.notification.gcm.GCMRegister.java

/**
 * GCMID??/*from  w  w  w .j ava 2  s  .c om*/
 *
 * @param context 
 * @return GCMID??????????????
 */
@NonNull
private static String getRegistrationId(@NonNull Context context) {
    final SharedPreferences prefs = getPreferences(context);
    final String registrationId = prefs.getString(PROPERTY_REG_ID, "");
    if (registrationId.isEmpty()) {
        Log.i(TAG, "Registration not found.");
        return "";
    }

    final int registeredVersion = prefs.getInt(PROPERTY_APP_VERSION, Integer.MIN_VALUE);
    final int currentVersion = getAppVersion(context);
    if (registeredVersion != currentVersion) {
        Log.i(TAG, "App version changed.");
        return "";
    }
    return registrationId;
}

From source file:de.wikilab.android.friendica01.activity.UserProfileActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    userId = getIntent().getStringExtra("userId");
    Log.i(TAG, "loading profile for userId=" + userId);

    setContentView(R.layout.userprofile);

    Button btn;/*from  w w w .  j  av a  2  s . co  m*/
    btn = (Button) findViewById(R.id.btn_nav_1);
    if (btn != null) {
        btn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                findViewById(R.id.content_fragment_1).setVisibility(View.VISIBLE);
                findViewById(R.id.content_fragment_2).setVisibility(View.GONE);
            }
        });
        btn = (Button) findViewById(R.id.btn_nav_2);
        btn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                findViewById(R.id.content_fragment_1).setVisibility(View.GONE);
                findViewById(R.id.content_fragment_2).setVisibility(View.VISIBLE);
            }
        });
    }

    final TwAjax t = new TwAjax(this, true, true);
    t.getUrlContent(Max.getServer(this) + "/api/users/show/" + userId, new Runnable() {
        @Override
        public void run() {

            try {
                JSONObject j = (JSONObject) t.getJsonResult();

                ((TextView) findViewById(R.id.profile_name)).setText(
                        Html.fromHtml("<b>" + j.getString("name") + "</b><br>" + j.getString("screen_name")));
                ((TextView) findViewById(R.id.header_text)).setText(j.getString("name") + "'s profile");

                ((ImageView) findViewById(R.id.profile_image)).setImageURI(
                        Uri.parse("file://" + Max.IMG_CACHE_DIR + "/friend_pi_" + j.getString("id") + "_.jpg"));

                String key, tx = "";
                Iterator<String> iter = j.keys();
                while (iter.hasNext()) {
                    key = iter.next();
                    tx += "<br><b>" + key + ":</b> " + String.valueOf(j.get(key));
                }

                ((TextView) findViewById(R.id.profile_content)).setText(Html.fromHtml(tx));

            } catch (Exception e) {

                ((TextView) findViewById(R.id.profile_content))
                        .setText(Html.fromHtml("<b>Error loading profile data!</b><br><br>" + e.toString()
                                + "<br><br>" + Max.Hexdump(t.getResult().getBytes())));

            }

        }
    });
}

From source file:org.openremote.android.console.util.HTTPUtil.java

public static int downLoadImage(Context context, String serverUrl, String imageName) {
    if (FileUtil.checkFileExists(context, imageName)) {
        Log.i("OpenRemote-SKIP IMAGE", imageName + " is already in cache");
    } else {/*w  w  w.j  a  v  a 2s . c  o  m*/
        Log.i("OpenRemote-NEW IMAGE", imageName + " downloading...");
        return downLoadFile(context, serverUrl + "/resources/" + encodePercentUri(imageName), imageName);
    }
    return 200;
}

From source file:net.reichholf.dreamdroid.intents.IntentFactory.java

public static Intent getStreamFileIntent(String fileName, String title) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    SimpleHttpClient shc = SimpleHttpClient.getInstance();
    ArrayList<NameValuePair> params = new ArrayList<>();
    params.add(new BasicNameValuePair("file", fileName));
    Uri uri = Uri.parse(shc.buildFileStreamUrl(URIStore.FILE, params));
    Log.i(DreamDroid.LOG_TAG, "Streaming file: " + uri.getEncodedQuery());

    intent.setDataAndType(uri, "video/*");
    intent.putExtra("title", title);
    return intent;
}

From source file:eu.trentorise.smartcampus.ac.network.RemoteConnector.java

public static TokenData validateAccessCode(String service, String code, String clientId, String clientSecret,
        String scope, String redirectUri) throws AACException {
    final HttpResponse resp;
    Log.i(TAG, "validating code: " + code);
    //        String url = service + PATH_TOKEN+"?grant_type=authorization_code&code="+code+"&client_id="+clientId +"&client_secret="+clientSecret+"&redirect_uri="+redirectUri;
    //        if (scope != null) url+= "&scope="+scope;
    final HttpPost post = new HttpPost(service + PATH_TOKEN);
    ArrayList<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("grant_type", "authorization_code"));
    params.add(new BasicNameValuePair("code", code));
    params.add(new BasicNameValuePair("client_id", clientId));
    params.add(new BasicNameValuePair("client_secret", clientSecret));
    params.add(new BasicNameValuePair("redirect_uri", redirectUri));
    if (scope != null)
        params.add(new BasicNameValuePair("scope", scope));

    post.setHeader("Accept", "application/json");
    try {/*from  w w w  .j  a v a 2  s.  co  m*/
        post.setEntity(new UrlEncodedFormEntity(params));
        resp = getHttpClient().execute(post);
        final String response = EntityUtils.toString(resp.getEntity());
        if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
            TokenData data = TokenData.valueOf(response);
            Log.v(TAG, "Successful authentication");
            return data;
        }
        Log.e(TAG, "Error validating " + resp.getStatusLine());
        throw new AACException("Error validating " + resp.getStatusLine());
    } catch (final Exception e) {
        Log.e(TAG, "Exception when getting authtoken", e);
        throw new AACException(e);
    } finally {
        Log.v(TAG, "getAuthtoken completing");
    }
}