Java Code Examples for android.webkit.ConsoleMessage#message()

The following examples show how to use android.webkit.ConsoleMessage#message() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BridgeWebChromeClient.java    From OsmGo with MIT License 6 votes vote down vote up
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
  String tag = "Capacitor/Console";
  if (consoleMessage.message() != null && isValidMsg(consoleMessage.message())) {
    String msg = String.format("File: %s - Line %d - Msg: %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
    String level = consoleMessage.messageLevel().name();
    if ("ERROR".equalsIgnoreCase(level)) {
      Log.e(tag, msg);
    } else if ("WARNING".equalsIgnoreCase(level)) {
      Log.w(tag, msg);
    } else if ("TIP".equalsIgnoreCase(level)) {
      Log.d(tag, msg);
    } else {
      Log.i(tag, msg);
    }
  }
  return true;
}
 
Example 2
Source File: WebView.java    From Small with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
    String msg = consoleMessage.message();
    if (msg == null)
        return false;
    Uri uri = Uri.parse(msg);
    if (uri != null && null != uri.getScheme() && uri.getScheme().equals(SMALL_SCHEME))
    {
        String host = uri.getHost();
        String ret = uri.getQueryParameter(SMALL_QUERY_KEY_RET);
        if (host.equals(SMALL_HOST_POP)) {
            WebActivity activity = mWebView.getActivity();
            if (activity != null) {
                activity.finish(ret);
            }
        } else if (host.equals(SMALL_HOST_EXEC)) {
            if (mWebView.mOnResultListener != null) {
                mWebView.mOnResultListener.onResult(ret);
            }
        }
        return true;
    }
    Log.d(consoleMessage.sourceId(),
            "line" + consoleMessage.lineNumber() + ": " + consoleMessage.message());
    return true;
}
 
Example 3
Source File: WebPlayerView.java    From unity-ads-android with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
	Boolean returnValue = false;

	if (shouldCallSuper("onConsoleMessage")) {
		returnValue = super.onConsoleMessage(consoleMessage);
	}
	if (shouldSendEvent("onConsoleMessage")) {
		String message = "";
		if (consoleMessage != null) {
			message = consoleMessage.message();
		}
		WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.WEBPLAYER, WebPlayerEvent.CONSOLE_MESSAGE, message, viewId);
	}
	if (hasReturnValue("onConsoleMessage")) {
		returnValue = getReturnValue("onConsoleMessage", java.lang.Boolean.class, true);
	}

	return returnValue;
}
 
Example 4
Source File: SystemWebChromeClient.java    From chappiecast with Mozilla Public License 2.0 5 votes vote down vote up
@TargetApi(8)
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(LOG_TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 5
Source File: SystemWebChromeClient.java    From BigDataPlatform with GNU General Public License v3.0 5 votes vote down vote up
@TargetApi(8)
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(LOG_TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 6
Source File: CordovaChromeClient.java    From bluemix-parking-meter with MIT License 5 votes vote down vote up
@TargetApi(8)
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 7
Source File: SystemWebChromeClient.java    From cordova-plugin-intent with MIT License 5 votes vote down vote up
@TargetApi(8)
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(LOG_TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 8
Source File: CordovaChromeClient.java    From cordova-android-chromeview with Apache License 2.0 5 votes vote down vote up
@TargetApi(8)
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 9
Source File: SystemWebChromeClient.java    From lona with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(LOG_TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 10
Source File: CordovaChromeClient.java    From IoTgo_Android_App with MIT License 5 votes vote down vote up
@TargetApi(8)
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 11
Source File: CordovaChromeClient.java    From L.TileLayer.Cordova with MIT License 5 votes vote down vote up
@TargetApi(8)
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 12
Source File: SystemWebChromeClient.java    From countly-sdk-cordova with MIT License 5 votes vote down vote up
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(LOG_TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 13
Source File: CustomWebChromeClient.java    From ForPDA with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
    String message = "";
    message += "\"" + consoleMessage.message() + "\"";
    String source = consoleMessage.sourceId();
    if (source != null) {
        int cut = source.lastIndexOf('/');
        if (cut != -1) {
            source = source.substring(cut + 1);
        }
        message += ", [" + source + "]";
    }

    message += ", (" + consoleMessage.lineNumber() + ")";


    ConsoleMessage.MessageLevel level = consoleMessage.messageLevel();
    if (level == ConsoleMessage.MessageLevel.DEBUG) {
        Log.d(CONSOLE_TAG, message);
    } else if (level == ConsoleMessage.MessageLevel.ERROR) {
        Log.e(CONSOLE_TAG, message);
    } else if (level == ConsoleMessage.MessageLevel.WARNING) {
        Log.w(CONSOLE_TAG, message);
    } else if (level == ConsoleMessage.MessageLevel.LOG || level == ConsoleMessage.MessageLevel.TIP) {
        Log.i(CONSOLE_TAG, message);
    } else {
        Log.d(CONSOLE_TAG, message);
    }
    return true;
}
 
Example 14
Source File: CordovaChromeClient.java    From CordovaYoutubeVideoPlayer with MIT License 5 votes vote down vote up
@TargetApi(8)
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 15
Source File: CordovaChromeClient.java    From reader with MIT License 5 votes vote down vote up
@TargetApi(8)
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 16
Source File: SystemWebChromeClient.java    From keemob with MIT License 5 votes vote down vote up
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(LOG_TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 17
Source File: CordovaChromeClient.java    From phonegapbootcampsite with MIT License 5 votes vote down vote up
@TargetApi(8)
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 18
Source File: AuthActivity.java    From letv with Apache License 2.0 5 votes vote down vote up
public final boolean onConsoleMessage(ConsoleMessage consoleMessage) {
    String message = consoleMessage.message();
    if (TextUtils.isEmpty(message)) {
        return super.onConsoleMessage(consoleMessage);
    }
    Object obj = null;
    if (message.startsWith("h5container.message: ")) {
        obj = message.replaceFirst("h5container.message: ", "");
    }
    if (TextUtils.isEmpty(obj)) {
        return super.onConsoleMessage(consoleMessage);
    }
    AuthActivity.b(this.a, obj);
    return super.onConsoleMessage(consoleMessage);
}
 
Example 19
Source File: CordovaChromeClient.java    From phonegap-plugin-loading-spinner with Apache License 2.0 5 votes vote down vote up
@TargetApi(8)
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}
 
Example 20
Source File: SystemWebChromeClient.java    From pychat with MIT License 5 votes vote down vote up
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage)
{
    if (consoleMessage.message() != null)
        LOG.d(LOG_TAG, "%s: Line %d : %s" , consoleMessage.sourceId() , consoleMessage.lineNumber(), consoleMessage.message());
     return super.onConsoleMessage(consoleMessage);
}