I am using branch io to implement deep linking in our react native app. I am able to navigate to different screens using the deep link from push notification when the app is in background state .
The issue occurs when app is started from fresh state. We have a Splash screen that is the default screen that loads after app starts and some logic is written in it like initializing app location ,verifying the jwt token is valid. Setting app localizations.
After these actions we navigate user to the home screen. In case of using deep link to fresh start the app it skips the Splash screen and navigates straight to the specific screen and in the result the actions we have to perform on Splash screen get skipped.
Please suggest a way to deal with this issue.
Related
Am totally stuck with something. Working on deep link and its redirection. When clicking on a deep link it's getting redirected to my app. I have added the code to handle in my HomePage.js.
Scenario 1:
If app is removed from background in phone then the deep link redirection works great
Scenario 2:
If app is kept at HomePage.js and left in background of device. then on deep link click opens the app no redirection happens.
Scenario 3:
If app is kept at HomePage.js which have AppState.addListener() and left at background and then on click of deep link HomePage state change listener is hit but there is no url.
Expected behaviour
App should detect its being redirected when its on any page with the url.
Using onesignal, When one sets the push notification value "url" for a notificaiton to open in an app, aka universal linking, by default the app is opened and a webview screen emerges (not on android, only iOS - at least in React Native).
I want to ignore this webview. I don't want to open it. The url is supposed to open the app to the corresponding universal link/deep link, not my domain on a web broswer. If I click on a similar link from a non-notificaiton source, it takes me to the screen, why does the push notification not do this?
How do I override this? I can't seem to figure it out. Do I have to manually implement this? Why does it open a webview by default and not the corresponding screen in the app instead?
It seems you have to manually route it if one were to go this route, unfortunately. From what I'm gathering bits here and there.
this is a bad choice to go with if you're using iOS:
https://www.myapp.com/p/fdsafa
this is better:
myapp://p/fdsafa
unfortunately onesignal has it setup in some weird way with the https://www.myapp.com that it makes it useless on iOS, unless your actual intention is to open an actual web url in a webview. Where as myapp:// is compatible with both platforms (just don't put a host on Android, leave the host out, just do the myapp as the schema). Works.
My React-Native App has a headlessTask that is triggered when device receives an SMS. I want my app to open a screen when the SMS is received, even when app is not running.
I'm familiar with react-navigation, but since a headlessTask is not a component, I can't even send the navigation prop.
What I have tried:
Headless Task use inside component with React Native
the solution above only works if application is open.
P.S. In Native Android, I'm able to achieve this by starting the Activity inside the broadcast receiver.
You can use deep linking.
In your headless task use something like this:
Linking.openURL('example://sms-received/sms-data')
Also you should handle deep links in your app.
"react-native-navigation": "^2.0.0-experimental.133"
In order to use Auth0lock for login and profile creation a single screen app is started which on login, should call startTabBasedApp and transition to tabbed app. What I am seeing is that auth0 view is popped and I am left in my single screen app root. Log suggests that the app is started. Reloading works as expected, but at that point I never go to Auth0lock view. Any suggestions?
I am developing a hybrid app and my first page is native page in both android and ios. I kept initial html page as blank white background and loading native page by using the WL.nativePage.show API method.
I am able to go to native page but after the splash screen, it's showing a white screen which is my HTML page for a while then the native pages is displayed. So I want to avoid that white screen. How to do that?
My code for showing native is:
function wlCommonInit() {
WL.NativePage.show('ProductHomeViewController', backFromNativePage, params);
}
This is not easily doable in Worklight 6.1, but is likely to be improved in a later release.
In Android, you can change in AndroidManifest.xml the default activity the application starts with that of yours (the activity you have created for your Native Page)
In iOS, you can start another UIViewController from CDVMainViewController
The above will help to have a Hybrid app that its "start page" (the page you see after the splash image) is a native page, HOWEVER, this will not help in sharing the session between the Hybrid and Native pages (as explained in the answer to this question by you).
There is work in progress to create a Cordova plug-in that will allow session sharing between hybrid and native pages when the native page is the starting page of the application; it is not yet ready. As I wrote at the top, in a future release all of this should work better.
To address the questions in the comments:
The Hybrid application also contains that same Native API as a Native application would, this means that once you launch the app and navigate to a native page after the splash image (based on the above), you can still use the same native API methods to connect to the Worklight Server, invoke Worklight Adapters, etc.
The problem is still the sharing of the cookies (session) between the native webview and the hybrid webview.
Again, as written above, there is work in progress to create a Cordova plug-in that will allow session sharing between hybrid and native pages when the native page is the starting page of the application; it is not yet ready. In a future release all of this should work better.