コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTag("WebPageViewActivity ");
    Log("Actividad Inicializada");

    setContentView(R.layout.activity_web_page_view);

    wv_garitas = (WebView) findViewById(R.id.wv_garitas);
    progressDialog = new ProgressDialog(getApplicationContext());

    String url =
        (String) getText(R.string.url_garitastijuana)
            + "?Ref=AndroidApp"
            + "&AppVersion"
            + GetAppVersion()
            + "&VersionCodo="
            + GetVersionCode();

    wv_garitas.getSettings().setJavaScriptEnabled(true);
    wv_garitas.setWebViewClient(
        new WebViewClient() {
          @Override
          public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            Log("Pagina Cargada");
            if (progressDialog != null) progressDialog.dismiss();
          }
        });

    ShortToast((String) getText(R.string.message_cargando));

    if (InternetConnectivity()) {
      progressDialog = new ProgressDialog(this);
      progressDialog.setTitle(getString(R.string.message_cargando));
      progressDialog.setMessage(getString(R.string.message_wait));
      progressDialog.show();
      Log("Obteniendo Pagina " + url);

      Answers.getInstance()
          .logContentView(
              new ContentViewEvent()
                  .putContentName("Carga")
                  .putContentType("Web")
                  .putContentId("1"));

      wv_garitas.loadUrl(url);
      wv_garitas.scrollTo(0, 0);
      Log("Fin de Obtencion");

    } else {
      ShortToast((String) getText(R.string.message_nointernet));
      Log("No Internet");
    }

    // ATTENTION: This was auto-generated to implement the App Indexing API.
    // See https://g.co/AppIndexing/AndroidStudio for more information.
    client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
  }
コード例 #2
0
  @Override
  public void onStop() {
    super.onStop();

    // ATTENTION: This was auto-generated to implement the App Indexing API.
    // See https://g.co/AppIndexing/AndroidStudio for more information.
    AppIndex.AppIndexApi.end(client, getIndexApiAction());
    client.disconnect();
  }