Open 13dante04 opened 3 years ago
Hi, I was going to post a comment saying I had the same problem - after spending too many hours - but I just checked one thing before and it seems like I solved my issue.
In the @nativescript-communite/appurl plugin, it says in the readme:
The android:launchMode="singleTask" tells the Android operating system to launch the app with a new instance of the activity, or use an existing one. Without this your app will launch multiple instances of itself which is no good.
I guess the router gets a bit lost if it isn't in singleTask
.
So this is the line that saved me spending even more time:
<activity android:name="com.tns.NativeScriptActivity" ... android:launchMode="singleTask"...>
I hope this helps you !
PS: the navigation was kind of working when I was logging the component but it wouldn't display anything so it looked like it wasn't working.
Environment package.json contents
Describe the bug Navigation on android stops working when navigation after the app resumes. I implemented opening the app from an external link which holds some data in the query parameters. Dependant on those parameters I navigate the app to a specific part of the application. The specific case is when the app is running, I suspend it (put it in background) to get to the link, tap the link (which opens the app through an intent-filter), then I handle the data coming from the link. After that I navigate the app (I have to call ngZone.run() to navigate otherwise it doesn't work.
e.g. using the handleOpenURL from '@nativescript-community/appurl', I call
Ill paste the routing modules just so you can see the structure. auth-routing.module.ts
app-routing.module routes:
after navigating to the reset-pw, no navigation seems to work, back button does nothing, routerExtensions.navigate(...) does nothing, calling goBack on routerExtensions also does nothing.
This behaviour does not happen if the app is closed when I click the link, and this behaviour does not happen if I navigate to ['/auth'] only
e.g.
I tried with redirects both on the main routing module and module specific routing module the issue persists.
EDIT: I tried subscribing to router events, they do trigger everytime I tap the buttton calling the routerExtensions.navigate but the app stays on the same page. Also I am using only one page-router-outlet in the app.component.html