Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Navigation Activites on Deep Linking andorid

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 786
    Comment on it

    This blog is about Navigation of application activities. When an Activity is opened with Deep Linking then pressing back button close application instead of working in normal backstack flow.

    If you are not familiar with Deep Linking then please checkout my blog on Deep Linking. 

    http://findnerd.com/account/#url=/list/view/Deep-Linking-for-App-content-Android-/7898/

    Here are some steps to Navigate or add Parent Activity to Deep Linking Activity.

    1.Create Project.

    2. Create Activity with name MainActivity.java. It will be Parent Activity for this blog.

    3. Create another Activity with name LinkingActivity.java. This activity is open with deep linking.

    4. Add Deep Linking to LinkingActivity  under <activity> in manifest.

     <intent-filter android:label="Deeplinking">
                    <action android:name="android.intent.action.VIEW" />
    
                    <category android:name="android.intent.category.DEFAULT" />
                    <category android:name="android.intent.category.BROWSABLE" />
    
                    <data
                        android:host="www.findnerd.com"
                        android:pathPrefix="/aman"
                        android:scheme="http" />

    5. Add Parent Activity to LinkingActivity Tag in manifest.

    android:parentActivityName=".MainActivity"

    6. Add meta tag within <activity>.

     <meta-data
                    android:name="android.support.PARENT_ACTIVITY"
                    android:value=".MainActivity" />

    7. Full <activty> code:-

      <activity
                android:name=".LinkingActivity"
                android:parentActivityName=".MainActivity">
    
                <meta-data
                    android:name="android.support.PARENT_ACTIVITY"
                    android:value=".MainActivity" />
    
                <intent-filter android:label="Deeplinking">
                    <action android:name="android.intent.action.VIEW" />
    
                    <category android:name="android.intent.category.DEFAULT" />
                    <category android:name="android.intent.category.BROWSABLE" />
    
                    <data
                        android:host="www.findnerd.com"
                        android:pathPrefix="/aman"
                        android:scheme="http" />
    
                </intent-filter>
    
            </activity>

     

    Open Linking Activity with Deep link and when you press Navigation Back press button then Main Activity will open.

     

    GitHub sample:- https://github.com/AmanChugh/DeepLinking_with_parent_activity.

    Happy Coding :D
     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: