15. April 2019

Android Emulator application crash: Chromium WebView package does not exist

Android application with WebView might crash with a strange error in Android Emulator:

E/WebViewFactory: Chromium WebView package does not exist
    android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed
        at android.webkit.WebViewFactory.getWebViewContextAndSetProvider(WebViewFactory.java:334)
        at android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:398)
        at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:211)
....

Check the definition of Virtual Device. It’s very likely that your device is using plain Android target which does not contain the WebView. You have to create Virtual Device which contains Google APIs.

Click Create Virtual Device. Select an image with “Google APIs“:

Now you can start the application in the newly created emulator with Google APIs.

The application should run without a problem.

23. May 2015

Flask OAuthlib Multiple Scope Values for calling Google API

Google provides myriad of APIs for invoking operations on Google App Platform. It’s possible to integrate this calls with custom app using OAuth.

One option is to write app based on Flask (Python Microframework) with OAuth support provided by Flask-OAuthlib.

There is simple example of web app in Lepture’s repo.

The key practice in OAuth world is to get user’s consent to access API on her/his behalf. Often implemented by simple consent screen.

google-consent

You need to perform two steps to display consent screen:

  • enable API in Developer Console
  • define scope in your application

The second step is straightdorward:

google = oauth.remote_app(
    'google',
    ...
    request_token_params={
        'scope': 'https://www.googleapis.com/auth/userinfo.email'
    },
    ...
)

It works perfectly. The only problem is that this solution provides access just to one API.

The question is: How to request access to multiple scopes?

You can find many hints about OAtuh for other frameworks, that you should separate scopes by comma. That won’t work.

Correct solution is to use white space as delimiter of scopes (as suggested for HTML forms).

google = oauth.remote_app(
    'google',
    ...
    request_token_params={
        'scope': 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/calendar.readonly https://www.googleapis.com/auth/tasks'
    },
    ...
)

14. May 2013

How to debug :hover pseudo class in Google Chrome Developer tool

Google Chrome developer tool is simply one of the best tools available for debugging of HTML5 applications.

It has one neat feature: possibility to inspect CSS of element and editing it on the fly.

That works fine for normal styles, but what about :hover state?

There is one “hidden” option which allows to switch element to :hover state.

Inspect element of HTML. You should see Styles on the right hand side. There are 3 icons. Click the middle one with arrow sign. It will pop up menu with checkboxes. You can select here CSS pseudo classes like :active, :focus, :hover or :visited.

google-chrome-dev-hover

To learn more about capabilities of Google Chrome developer tools I recommend to go through free course Discover Dev Tools from Codeschool.com.

1. July 2011

Google Gravity

Do you know what happens if you apply gravity constant on HTML elements?

No? Try to search for something by this enhanced Google Search page.

It is part of Mr. Doob 3D experiments.