8 Replies Latest reply on Feb 9, 2017 8:02 AM by Jacques Gourmelen

    Starting an application from the Lollipop browser - HOW TO?

    Jacques Gourmelen

      Regardless of the below approach - I.e. Method A or Method B - used to launch my application, the Lollipop browser inevitably raises a net::ERR_UNKWON_URL_SCHEME error

      Note: such difficulty is not observed while using the KitKat Browser.

       

      HTML page used to launch my app

      <a href="myscheme://">Method A</a>

      <a href="intent:/#Intent;scheme=myscheme;package=com.zebra.bqmk34.spr31005;action=android.intent.action.VIEW;category=android.intent.category.DEFAULT;category=android.intent.category.BROWSABLE;end">Method B</a>

       

       

      AndroidManifest.xmlMainActivity.java
      <?xml version="1.0" encoding="utf-8"?>
      <manifest xmlns:android="http://schemas.android.com/apk/res/android"
         
      package="com.zebra.bqmk34.spr31005">

          <
      application
             
      android:allowBackup="true"
             
      android:icon="@mipmap/ic_launcher"
             
      android:label="@string/app_name"
             
      android:supportsRtl="true"
             
      android:theme="@style/AppTheme">
              <
      activity
                 
      android:name=".MainActivity"
                 
      android:label="@string/app_name"
                 
      android:theme="@style/AppTheme.NoActionBar">
                  <
      intent-filter>
                      <
      action android:name="android.intent.action.MAIN" />

                      <
      category android:name="android.intent.category.LAUNCHER" />
                  </
      intent-filter>

                  <
      intent-filter>
                      <
      action android:name="android.intent.action.VIEW" />
                      <
      category android:name="android.intent.category.DEFAULT" />
                      <
      category android:name="android.intent.category.BROWSABLE" />
                      <
      data android:scheme="myscheme" />
                  </
      intent-filter>

              </activity>
          </
      application>
      </
      manifest>
      @Override
      protected void onCreate(Bundle savedInstanceState) {
         
      super.onCreate(savedInstanceState);
          setContentView(R.layout.
      activity_main);

         
      txtInfo = (TextView)findViewById(R.id.txtInfo);
          Intent intent = getIntent();
         
      if (intent != null){
              String strAction = intent.getAction();
              Log.d(
      TAG, "Intent action = " + strAction);
              Uri launchUriPassedIn = intent.getData();
             
      if (launchUriPassedIn != null) {
                 
      txtInfo.setText(launchUriPassedIn.toString());
                  Log.d(
      TAG, "URI = " + launchUriPassedIn.toString());
                  String strQuery = launchUriPassedIn.getQuery();
                  Log.d(
      TAG, "URI Query = " + strQuery);
              }
             
      else {
                 
      txtInfo.setText("No intent data found!");
                  Log.d(
      TAG, "No intent data found!");
              }
          }
         
      else {
             
      txtInfo.setText("No intent found!");
              Log.d(
      TAG, "No intent found!");
          }
      }

       

      Any hint is welcome!

      Thank you.