skip to Main Content

The android intent filter does not launch the application

            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                android:scheme="http"
                android:host="facix.fr" />
            </intent-filter>

            <intent-filter android:autoVerify="true">
                <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"
                android:host="facix.fr" />
            </intent-filter>

The url im being redirected to is : https://facix.fr/success

How can I change my android manifest to make the redirection on my app working ?

2

Answers


  1. You could add the path /success at the element data to catch the url

    <data
        android:scheme="https"
        android:host="facix.fr"
        android:path="/success" />
    

    To test if your intent filter is properly configured you can use this command line.
    I hope that will help you

    adb shell am start -W -a android.intent.action.VIEW -d "https://facix.fr/success" your.package.name
    
    Login or Signup to reply.
  2. Here the analysis of the output:

    Starting: Intent {…} -> Indicates that the intent has been launched including the action android.intent.action.VIEW and the data: https://facix.fr/.

    The warning -> Indicates that the desired activity is already running and the intent has been passed to the existing instance for processing.

    To better understand what is happening, you need to check how MainActivy manages the incoming intent.
    I recommend logging the intent that MainActivity receives in the OnCreate() and OnNewIntent():

    override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         setContentView(R.layout.activity_main)
    
         val intent = intent
         val action = intent.action
         val data = intent.data
    
         if (Intent.ACTION_VIEW == action && data != null) {
             val url = data.toString()
    
             Log.d("MainActivity", "onCreate(): Intent received with URL: $url")
    
         }
    
    
    }
    
    override fun onNewIntent(intent: Intent) {
             super.onNewIntent(intent)
             setIntent(intent) // Update the intent of MainActivity
        
             val data = intent.data
             if (data != null) {
                 val url = data.toString()
        
                 Log.d("MainActivity", "onNewIntent(): Intent received with URL: $url")
             }
        }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search