Umer
Umer

Reputation: 1556

Trying to add Deep Linking my Android App

My app is working fine but whenever i add deep link code in my manifest my app lunching icon disappears this is my manifest file

<activity
    android:name=".login.LoginActivity"
    android:screenOrientation="portrait">
    <intent-filter>
        <category android:name="android.intent.category.LAUNCHER" />
        <action android:name="android.intent.action.MAIN" />
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="https" />
        <data android:host="gizbo.ae" />
    </intent-filter>
</activity> 

When ever i add these three line for deep linking. App icon launching icon disappears from device.

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="https" />
<data android:host="gizbo.ae" />

even i removed these two lines

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/> 

again same problem.

i just want to make my app visible in Google search and i am following this link

Upvotes: 3

Views: 2796

Answers (2)

Simon Marquis
Simon Marquis

Reputation: 7516

You must use multiple intent-filter tags:

  <activity
        android:name=".login.LoginActivity"
        android:screenOrientation="portrait">
        <intent-filter>
            <category android:name="android.intent.category.LAUNCHER" />
            <action android:name="android.intent.action.MAIN" />
        </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="https" />
            <data android:host="gizbo.ae" />
        </intent-filter>
    </activity> 

Upvotes: 12

Tharindu Welagedara
Tharindu Welagedara

Reputation: 2725

You have to add another activity to use deep linking and then start your login activity and pass your data to that.

So declare the activity as below:

 <activity
            android:name=".DeelinkActivity"
            android:screenOrientation="portrait"
            android:launchMode="singleTask"
            android:windowSoftInputMode="adjustResize|stateAlwaysHidden">
            <!-- URL scheme -->
            <intent-filter>
                <data android:host="gizbo.ae"
                    android:scheme="https" />

                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
            <!-- End URL scheme -->
  </activity>

and then in onCreate in that activity you can call the login activity also from there you can pass your data to that activity.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Intent intent = getIntent();
    String action = intent.getAction();
    Uri data = intent.getData();
    //put code to pass data as extras and Start your login activity here
}

Good luck.

Upvotes: 1

Related Questions