Example usage for android.util Log INFO

List of usage examples for android.util Log INFO

Introduction

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

Prototype

int INFO

To view the source code for android.util Log INFO.

Click Source Link

Document

Priority constant for the println method; use Log.i.

Usage

From source file:com.irccloud.android.HTTPFetcher.java

public void cancel() {
    Crashlytics.log(Log.INFO, TAG, "HTTP request cancelled");
    isCancelled = true;
}

From source file:com.github.tony19.timber.loggly.JsonFormatterTest.java

@Test
public void formatRendersInfoLevel() throws IOException {
    final JsonLog log = getLog(Log.INFO, "tag", "message", new RuntimeException());
    assertThat(log.level, is(equalTo("INFO")));
}

From source file:com.google.android.gcm.demo.logic.DeviceGroupsHelper.java

/**
 * Execute the HTTP call to create the Device Group in background.
 *
 * <code>// w w  w.  j av  a 2 s  . c om
 *   Content-Type: application/json
 *   Authorization: key=API_KEY
 *   project_id: SENDER_ID
 *   {
 *     "operation": "create",
 *     "notification_key_name": "appUser-Chris",
 *     "registration_ids": ["4", "8", "15", "16", "23", "42"]
 *   }
 * </code>
 */
public void asyncCreateGroup(final String senderId, final String apiKey, final String groupName,
        Bundle members) {
    final Bundle newMembers = new Bundle(members);
    new AsyncTask<Void, Void, Void>() {
        @Override
        protected Void doInBackground(Void... voids) {
            try {
                HttpRequest httpRequest = new HttpRequest();
                httpRequest.setHeader(HEADER_CONTENT_TYPE, CONTENT_TYPE_JSON);
                httpRequest.setHeader(HEADER_AUTHORIZATION, "key=" + apiKey);
                httpRequest.setHeader(HEADER_PROJECT_ID, senderId);

                JSONObject requestBody = new JSONObject();
                requestBody.put("operation", "create");
                requestBody.put("notification_key_name", groupName);
                requestBody.put("registration_ids", new JSONArray(bundleValues2Array(newMembers)));

                httpRequest.doPost(GCM_GROUPS_ENDPOINT, requestBody.toString());

                JSONObject responseBody = new JSONObject(httpRequest.getResponseBody());

                if (responseBody.has("error")) {
                    mLogger.log(Log.INFO, "Group creation failed." + "\ngroupName: " + groupName
                            + "\nhttpResponse:" + httpRequest.getResponseBody());
                    MainActivity.showToast(mContext, R.string.group_toast_group_creation_failed,
                            responseBody.getString("error"));
                } else {
                    // Store the group in the local storage.
                    DeviceGroup group = new DeviceGroup();
                    group.notificationKeyName = groupName;
                    group.notificationKey = responseBody.getString("notification_key");
                    for (String name : newMembers.keySet()) {
                        group.tokens.put(name, newMembers.getString(name));
                    }

                    Sender sender = mSenders.getSender(senderId);
                    sender.groups.put(group.notificationKeyName, group);
                    mSenders.updateSender(sender);

                    mLogger.log(Log.INFO, "Group creation succeeded." + "\ngroupName: "
                            + group.notificationKeyName + "\ngroupKey: " + group.notificationKey);
                    MainActivity.showToast(mContext, R.string.group_toast_group_creation_succeeded);
                }
            } catch (JSONException | IOException e) {
                mLogger.log(Log.INFO, "Exception while creating a new group" + "\nerror: " + e.getMessage()
                        + "\ngroupName: " + groupName);
                MainActivity.showToast(mContext, R.string.group_toast_group_creation_failed, e.getMessage());
            }
            return null;
        }
    }.execute();
}

From source file:com.scvngr.levelup.core.util.LogManager.java

/**
 * Log a message./*  w  w w .  jav a  2  s  .  co m*/
 *
 * @param msg message to log. This message is expected to be a format string if varargs are
 *            passed in.
 * @param args optional arguments to be formatted into {@code msg}.
 */
public static void i(@NonNull final String msg, @Nullable final Object... args) {
    logMessage(Log.INFO, msg, args, null);
}

From source file:au.com.cybersearch2.classyfy.provider.ClassyFyProvider.java

/**
 * onCreate() called before Application onCreate(), so can do nothing as DI not initialized.
 * @see android.content.ContentProvider#onCreate()
 *///from  w  w  w .  j a va2 s  .c  o  m
@Override
public boolean onCreate() {
    final ClassyFyApplication application = ClassyFyApplication.getInstance();
    AsyncBackgroundTask starter = new AsyncBackgroundTask(application) {
        @Override
        public Boolean loadInBackground() {
            Log.i(TAG, "Loading in background...");
            // Get perisistence context to trigger database initialization
            // Build Dagger2 configuration
            if (Log.isLoggable(TAG, Log.INFO))
                Log.i(TAG, "ClassyFy application Dagger build");
            DaoManager.clearCache();
            try {
                classyFyComponent = DaggerClassyFyComponent.builder()
                        .classyFyApplicationModule(new ClassyFyApplicationModule(application)).build();
                startApplicationSetup(classyFyComponent.persistenceContext());
            } catch (PersistenceException e) {
                Log.e(TAG, "Database error on initialization", e);
                return Boolean.FALSE;
            }
            classyFySearchEngine = classyFyComponent.classyFySearchEngine();
            FtsEngine ftsEngine = classyFyComponent.ftsEngine();
            classyFySearchEngine.setFtsQuery(ftsEngine);
            application.setComponent(classyFyComponent);
            return Boolean.TRUE;
        }

        @Override
        public void onLoadComplete(Loader<Boolean> loader, Boolean success) {
            Log.i(TAG, "Loading completed " + success);
        }
    };
    starter.startLoading();
    return true;
}

From source file:com.google.android.marvin.mytalkback.TtsDiscoveryProxyActivity.java

/**
 * Initialized discovery and sends a broadcast intent.
 *///  w w  w  . ja v a 2  s.  c  o m
private void startAndNotify() {
    LogUtils.log(this, Log.INFO, "Initializing TTS discovery proxy...");

    final Intent broadcastIntent = new Intent(BROADCAST_TTS_DISCOVERY_STARTED);
    mBroadcastManager.sendBroadcast(broadcastIntent);

    if (!handleIntent()) {
        finishAndNotify();
    }
}

From source file:de.madvertise.android.sdk.MadvertiseMraidView.java

public MadvertiseMraidView(Context context) {
    super(context);
    setVerticalScrollBarEnabled(false);/*w w  w .  ja  v a  2  s .c  om*/
    setHorizontalScrollBarEnabled(false);
    setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
    setBackgroundColor(Color.TRANSPARENT);
    WebSettings settings = getSettings();
    settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    settings.setJavaScriptEnabled(true);
    //settings.setPluginsEnabled(true);

    // Initialize the default expand properties.
    DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
    mExpandProperties = new ExpandProperties(metrics.widthPixels, metrics.heightPixels);
    MadvertiseUtil.logMessage(null, Log.INFO,
            "Setting default expandProperties : " + mExpandProperties.toJson().toString());

    // This bridge stays available until this view is destroyed, hence no
    // reloading when displaying new ads is necessary.
    addJavascriptInterface(mBridge, "mraid_bridge");

    setWebViewClient(new WebViewClient() {
        private boolean mError = false;

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, final String url) {
            post(new Runnable() {
                @Override
                public void run() {
                    if (mListener != null) {
                        mListener.onAdClicked();
                    }
                    final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url),
                            getContext().getApplicationContext(), MadvertiseActivity.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    getContext().startActivity(intent);
                }
            });
            return true;
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            if (!url.endsWith("mraid.js") && !mError) {
                MadvertiseUtil.logMessage(null, Log.DEBUG, "Setting mraid to default");
                checkReady();

                // Close button in default size for interstitial ads
                if (mPlacementType == MadvertiseUtil.PLACEMENT_TYPE_INTERSTITIAL) {
                    mCloseButton = addCloseButtonToViewGroup(((ViewGroup) getParent()));
                    mCloseButton.setImageResource(android.R.drawable.ic_menu_close_clear_cancel);
                }
            }
        }

        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            super.onReceivedError(view, errorCode, description, failingUrl);
            mError = true;
        }
    });

    // Comment this in to enable video tag-capability.
    this.setWebChromeClient(new WebChromeClient() {

        @Override
        public void onShowCustomView(View view, CustomViewCallback callback) {
            MadvertiseUtil.logMessage(null, Log.INFO, "showing VideoView");
            super.onShowCustomView(view, callback);
            if (view instanceof FrameLayout) {
                FrameLayout frame = (FrameLayout) view;
                if (frame.getFocusedChild() instanceof VideoView) {
                    mVideo = (VideoView) ((FrameLayout) view).getFocusedChild();
                    frame.removeView(mVideo);
                    ((ViewGroup) getParent()).addView(mVideo);

                    // Will also be called onError
                    mVideo.setOnCompletionListener(new OnCompletionListener() {

                        @Override
                        public void onCompletion(MediaPlayer player) {
                            player.stop();
                        }
                    });

                    mVideo.setOnErrorListener(new OnErrorListener() {

                        @Override
                        public boolean onError(MediaPlayer mp, int what, int extra) {
                            MadvertiseUtil.logMessage(null, Log.WARN, "Error while playing video");

                            if (mListener != null) {
                                mListener.onError(new IOException("Error while playing video"));
                            }

                            // We return false in order to call
                            // onCompletion()
                            return false;
                        }
                    });

                    mVideo.start();
                }
            }
        }

        @Override
        public void onHideCustomView() {
            if (mVideo != null) {
                ((ViewGroup) getParent()).removeView(mVideo);
                if (mVideo.isPlaying()) {
                    mVideo.stopPlayback();
                }
            }
        }
    });
}

From source file:com.scvngr.levelup.core.util.LogManager.java

/**
 * Log a message.//from w w w .ja  v a 2  s  . c  o  m
 *
 * @param msg message to log.
 * @param err an exception that occurred, whose trace will be printed with the log message.
 */
public static void i(@NonNull final String msg, @NonNull final Throwable err) {
    logMessage(Log.INFO, msg, null, err);
}

From source file:com.google.android.marvin.mytalkback.TtsDiscoveryProxyActivity.java

/**
 * Finishes discovery and sends a broadcast intent. Calls {@link #finish()}
 * to exit the activity./*from   w w w .j  av  a2s  . c o  m*/
 */
private void finishAndNotify() {
    LogUtils.log(this, Log.INFO, "Finished discovering TTS engines");

    final Intent broadcastIntent = new Intent(BROADCAST_TTS_DISCOVERY_FINISHED);
    mBroadcastManager.sendBroadcast(broadcastIntent);

    finish();
}

From source file:com.ginstr.android.service.opencellid.upload.data.MeasurementsUploaderService.java

private void writeToLog(String message) {
    mLibContext.getLogService().writeLog(Log.INFO, OpenCellIdLibContext.LOG_FILENAME_PREFIX, message);
}