Orhan Tozan
09/02/2020, 1:32 PMService
to a Navigation Component destination (fragment)?Evan
09/02/2020, 2:13 PMActivity
that has a Navigation Host with the desired destination in its nav graph.Orhan Tozan
09/02/2020, 2:22 PMval pendingIntent = NavDeepLinkBuilder(context)
.setComponentName(YourActivity::class.java)
.setGraph(R.navigation.your_nav_graph)
.setDestination(R.id.your_destination)
.setArguments(bundle)
.createPendingIntent()
context.startActivity(pendingIntent)
Evan
09/02/2020, 2:23 PMOrhan Tozan
09/02/2020, 2:23 PMOrhan Tozan
09/02/2020, 2:27 PMstartActivity()
requires an Intent, not a pending intentEvan
09/02/2020, 2:32 PMActivity
onCreate
or onNewIntent
methods to interact with the NavHost.
Evan
09/02/2020, 2:33 PMOrhan Tozan
09/02/2020, 2:45 PMOrhan Tozan
09/02/2020, 2:46 PMEvan
09/02/2020, 2:49 PMval activityService = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val appTasks = activityService.appTasks
if(appTasks.size<1){
launchNewApplicationInstance()
}else{
appTasks.get(0).moveToFront()
}
Evan
09/02/2020, 2:49 PMEvan
09/02/2020, 2:50 PMIan Lake
09/02/2020, 3:31 PMcreatePendingIntent()
- use createTaskStackBuilder().startActivities()
Ian Lake
09/02/2020, 3:32 PMNavDeepLinkBuilder
already sets the appropriate flags so you won't have a separate instance (it replaces the current instance - don't use any launchMode
flags)Evan
09/02/2020, 3:33 PMIan Lake
09/02/2020, 3:34 PMEvan
09/02/2020, 3:36 PMIan Lake
09/02/2020, 3:37 PMcreatePendingIntent()
API is forIan Lake
09/02/2020, 3:38 PM