Thread
#compose
    Peter Mandeljc

    Peter Mandeljc

    1 year ago
    how can I receive image uri into my app? Do I need to receive Intent in my activity, and somehow send it to NavHost?
    Peter Mandeljc

    Peter Mandeljc

    1 year ago
    thanks for answer, but maybe wasn't clear enough, sorry
    I'm confused how to receive intent to my app, when using intent filter. So I can share image into my app. Basically this for compose.
    I know I have to make deeplink in NavHost, but not completely sure how Uri should be passed to there. I guess I need to receive it in Activity, and somehow send it to composable destination.
    i

    Ian Lake

    1 year ago
    You don't need to do anything, NavHost will take care of that part for you
    As long as you have the intent filter and deep link, that's all you need
    When you are deep linked to a destination, you'll get another argument: https://developer.android.com/reference/androidx/navigation/NavController.Companion#KEY_DEEP_LINK_INTENT()
    That argument has the full Intent
    Peter Mandeljc

    Peter Mandeljc

    1 year ago
    cool, thank you!
    gonna try it out
    do you mind helping me out a bit more? I'm confused how to create composable deeplink. How does this look to you:
    composable(
        route = "myroute",
    	deepLinks = listOf(
    		navDeepLink {
    		    uriPattern = "<app://com.app.myapp>" // ???
    		    action = Intent.ACTION_OPEN_DOCUMENT
    		    mimeType = "image/*"
    		}
    )
    i

    Ian Lake

    1 year ago
    The
    navDeepLink
    is a DSL builder because all of them are optional - if you aren't trying to handle a url, don't use
    uriPattern
    Your action and mime type should match the intent filter in your manifest - if you want to be in the share menu of other apps, that would be
    ACTION_SEND
    Peter Mandeljc

    Peter Mandeljc

    1 year ago
    hm, whenever I create a deeplink without uriPattern, navigation crashes for my "startDestination" composable
    java.lang.NullPointerException
            at androidx.navigation.NavDeepLink.getMatchingArguments(NavDeepLink.kt:153)
            at androidx.navigation.NavDestination.matchDeepLink(NavDestination.kt:335)
            at androidx.navigation.NavGraph.matchDeepLink(NavGraph.kt:69)
            at androidx.navigation.NavController.navigate(NavController.kt:1381)
            at androidx.navigation.NavController.navigate(NavController.kt:1687)
            at androidx.navigation.NavController.navigate$default(NavController.kt:1682)
            at androidx.navigation.NavController.navigate(NavController.kt:1668)
    i

    Ian Lake

    1 year ago
    Mm, that looks like a problem on our side, not something that you're doing wrong. Do you mind filing a bug so we can take a look? https://issuetracker.google.com/issues/new?component=409828
    Peter Mandeljc

    Peter Mandeljc

    1 year ago