I'm using React Native to merge two native apps into a single codebase, as an intermediate app I have a WebView-based solution where we just show parts of our website inside WebViews.
On iOS, the user logs into one WebView, then all other WebViews refresh in the background and once finished loading the user will be logged in and be able to access all logged in features.
I was expecting the same behaviour on Android, however nothing happens. It's as if the user never logged in. I tried manually setting the cookies with react-native-cookies, however this doesn't fix the issue either.
Is it possible to have the same functionality as iOS currently has on Android?
Related
I had a little trouble finding updated information about WebViews, and as a back-end developer, I would like to understand how they work and differ from the actual WebKit browser engine?
For practical purposes, I'm interested in the experience that happens by default for users when they scan a QR code using their native camera. I would like this to navigate to my website. The user would sign in, and I want to give them a cookie or session id to provide them with authentication.
As I understand, when a user scans a code with their camera, clicking on a link, the link is opened in a WebView, rather than their preferred browser. If the user closes the WebView after they sign in, such as by navigating back into their camera's functionality, the stored cookies will be lost.
Would appreciate references to the specific behavior and technical details of the webpage and storage information from browser pages opened from cameras on both iOS and Android.
I was trying to make an app using Android Webview. I am able to use Webview to load my site. My site is for registered users only. As a result, I wanted to create a Webview only for my logged in users. So, one layout (empty) for login page and another(tabbed) for logged in user.
So, is it possible to have 2 different layouts in a Webview in the same app? I am new in Android Studio and did not find specific discussion/solution of this problem elsewhere.
Share your thoughts. Thanks.
I have an android application say Sample App. I want to add App Links according to Android Developer Guide. I was successful in implementing them, but there was an problem with Chrome. When I access the corresponding Sample Web App and there is <a> tag with href="https://www.sample.com/profile" and it's also supported by App, it opens in app instead of continuing in Chrome.
I checked documentation and it is supposed to be default behavior of Chrome. But then I came across Linkedin app. The My Network tab they have when clicked in browser continues in browser but same link if I save to docs or any other application and click it then it opens in native app.
I want to know how this is done?
I believe this is because, as you said, the standard deep linking behavior is to route to the app if it is installed. This behavior is handed-off immediately when the link is clicked because your app overriders that url to be handled by app instead of Chrome.
First, I believe that you should route users to your application because its a better, more engaging experience, presumably.
If you are convinced, then I would change your manifest to strictly handle links that you want to handle. See this post to see how to handle only certain links.
Is there a way to prevent my site from being opened inside a UIWebView of any iOS or Android app, such as formatting the URL in a special way? These are apps that I do not own, so the call is coming from my page, not from the app.
Preferably, when an app tries to open the page on my site from within the UIWebView, it would automatically open up the page in the Safari or native browser app instead of inside the users application.
Otherwise, it looks like I would have to run some javascript to determine if the page is opened inside of a UIWebView and then just restrict access.
No. A browser is just an app. There is no specific distinction between a browser app using a webview and another app. That link for javascript browser detection will be pretty much useless for this scenario. Apps can set their user agents to whatever they want, including a user agent identical to what the native browser app uses. Essentially anything that you try to use to detect the default browser can be mimicked by another app.
You could change the user agent in your own app to something specific that you could then detect with javascript.
You can also call javascript functions in the webview from your iOS code so you could potentially wait to display things until that call comes from your app.
While these things can be easily mimicked, and wouldnt block a scraper that ignores javascript, it's unlikely someone will go through all the trouble. If you want further protection, you'll have to introduce some form of authentication.
I have a number of Drupal 7 websites (http://drupal.org) that have a mobile theme with JQuery mobile (http://jquerymobile.com/) for users browsing with smart phones or tablets. Although this provides a great mobile experience I would like to create an app for the Android and Iphone that uses a few built in features for content creation (mainly just the camera on node creation). I have eclipse and the android emulators all installed and have an installation of Phonegap working for Android testing. Here is where I need some advice on the best approach to my particular problem.
Basically each app can be almost entirely just a webview (easy), but I do need 2 features which should add enough uniqueness to make it able to get approved in the MAC app store.
Ability to add nodes using a REST service (along with phonegap) have access to the use phone’s camera to populate an image field.
A start or front-page has a fast login, and allows instant access to add content (all assets stored locally on phone, so even if the phone is offline, this page will still come up).
Ability to go from the regular mobile site (webview) back to the local node creation page (with access to the camera) or frontage.
Ability to pass something to the webview so I can hide content creation links that access the web version of node creation forms (which would not have the camera for example).
Here is where I’m confused. I don’t want to recreate the entire site and retrieve all the data using services (lots of tutorials and stuff I’ve seen are doing this including DrupalGap - http://drupal.org/project/drupalgap). That seems like a ton of redundant work that will require lots of continuous updates when the site is upgraded and changed with no real gain other than speed (For this it’s ok that it won’t be as fast).
For my mobile apps, when a user wants to view their profile, look at various pages etc, that should all happen in a webview, I only need services and the typical approach to mobile development for the front page, authentication and node creation. The rest should happen in a webview. So what is the best way to switch between adding nodes and authentication using a service and just going to a regular webview? Should I try embedding a webview in a page and having a small menu on the top that doesn’t’ change which links to the add content and login?
How do I setup the session for both the webview content and the service? Or how I can I force authentication through REST and then pass that on to the webview?
You don’t have to answer each one of those directly, I would just like some tips to get me started in the right direction. So far I’m thinking I create a “frontpage” for the app with all it’s assets stored locally on the phone, which has a login which authenticates through a web service (REST). After you login it shows the link to add nodes and a link to view the webview. The big question is how I use the same session for both and how to navigate between the 2 well?
I accomplished the goals stated above, by have the login use a REST service via jquery mobile in a regular html page (like this tutorial http://tylerfrankenstein.com/code/android-app-with-drupal-7-services-phonegap-and-jquery-mobile) this is also where the create content links can be placed. When you want the user to be able to open the "regular" mobile website and already be logged in, use the childbrowser phonegap plugin (https://build.phonegap.com/docs/plugins). Users can close the childbrowser and go back to the main dashboard by clicking the X, or you can create a listener that responds to them vising a specific URL (like the homepage).