Track Navigation in Android Webview - android

I'm wondering if there are any good tools for analyzing the navigation of an android application within a web view or within something like Cordova.
If an android application is changing states, is there a good tool to determine, for example the underlying URL that the application is currently on or was previously on? I'm doing an analysis of an already built android application and part of the requirements is to see what URL's the application navigates to but this isn't visible from the application itself. I only have the APK.
Perhaps ADB has this functionality or there are some third party tools available?

In my experience, the best tool is Chrome inspector: just type chrome://inspect in Chrome's address bar and connect to your device. Please note that your APK must be compiled in debug mode.

Related

How to install a PWA with Android WebView/TWA

Scenario
I have an existing native android app in which I want to add some new features. These features have already been implemented as a PWA because some users needed to use them directly from the web.
I want to be able to open the PWA with an Android WebView (as if it was part of my native application) and install it 'locally'. With 'locally' I mean that the PWA should not be visible as an app in the phone, it would just be part of my existing native app. In a way, what I'm trying to achieve is a king of "plugin" system, where I could have extra features that the user can install to the native app.
Where am I stuck?
Opening the PWA with a WebView is fairly straight forward. The part that I am unable to do is installing the PWA. Maybe TWA could solve this issue, but I am not sure it is meant for that.
Moreover, ideally I would like to keep everything in a Fragment since I would like to have the toolbar and others created by the native app (that is why I've leaned more towards using WebView instead of TWA).
EDIT---------------
After messing around I was able to understand that it actually gets installed with WebView. Since I haven't been able to find any information about how it works online I've been researching it on my own.
First of all ServiceWorkerController is only available from Android 7 (24). I haven't been able to test if with Android 6 this can work or not due to the fact that I don't have any phone with that version and I can't update the WebView apk of my emulators for some reason.
Then, I found out that the webpage crashed in my newer emulators because the WebView apk installed was too low and didn't support some newer features. So another thing to take into consideration the WebView version installed. This apk gets installed separately from the Android version (it's as if it was an app on your phone). The solution to this is to just use a real device, because the apk is usually always up to date.
As you can see in the following picture the PWA gets installed inside the app folder and it also keeps all the info (databases, localstorage, sessionstorage, etc.) in there.
It is unclear how this data is handled (I created this question) but it appears to be at least in the following cases:
WebStorage.Instance.DeleteAllData()
App uninstalled
App Data Cleared
Clearing the Cache of the app doesn't delete the persistent data.
So now I would say that the question would be:
From which Android Version does the Service Worker install? Just from the Android version that has support for the webview apk version that supports Service Workers?
Does it depend at all on ServiceWorkerController? Or is it just a utility class to have more control over what happens?

How can I deploy android apps using a manifest file, similar to iOS devices, without using an app store?

I want to deploy an Android app in a similar fashion as the Wireless, Over-The-Air method that exists for iOS devices. That is, setup a web page and the user clicks a link from his device that includes the manifest (xml) file, containing information on how to download the app. This works well on iOS devices, and I thought Android may have something similar.
How do I go about this?
Thank you for any help.
Please the comments above. Have the correct MIME settings, link to the apk, and make sure unknown sources is checked on the device to allow non-market apps.
Since you seem to imply an app market / store is not involved in the iOS case, it seems you might be talking about an offline-cacheable "web app" rather than a native iOS application.
The android equivalent is: on devices where the offline web app capability exists, just visit the same web page (referencing an html5 manifest with appropriate mime type, etc) you are using for iOS. Perhaps you will ultimately end up with platform-specific refinements, but the basic idea is portable.
Or perhaps you just mean that a desktop/laptop need not be used to open obtain the app. On Android, that has been the case since day 1 - the primary market client is on the device, with over-the-air install. You can send an android device to the market with a market:// url. The ability to trigger an install from a web browser running on something other than the device is a more recent and still secondary capability on android.
Finally, android does offer the ability to side load native applications, something that has no iOS equivalent outside of jailbreaking or having a developer account. Most of the responses seem to concentrate on this, but it's not clear if that is what you are actually asking for.

Deploying tool for our existing customers to iPhone and Android

We will be developing a free tool for our existing customers. I have no experience with iPhone and Android but as far as I'm aware you can't just put a file online and add a download link to it.
I'm wondering what are the best options to deliver this application to our customers? Should we just place it in App Store and Android Market (even though it might confuse the people who stumble upon the app and have no idea what or who it's for)?
I'm also aware of Apple's Enterprise Program. I'm not sure how it works technically but it sounds like it can be distributed from local network only, or am I wrong? The app should be obtainable online.
Is it possible to put app in App Store/Market without making it searchable & browseable in the app list of the Store/Market but accessible via direct link only?
Thank you for any suggestions.
For iPhone you need to use the iOS Enterprise Program to create your private market as long as the devices are not jailbreaked.
For Android you can distribute the installation file (.apk file) over your website. You have to tell the users to check the option "Install apps from unknown sources" (look here) in their preferences.
It really sounds like a "mobile web app" is what you're looking for.
There are several toolkits for styling web pages to look and act like an iPhone/Android app.
The user simply navigates to your site, and you can detect if they're browsing from a mobile device and render the page(s) based on that or redirect them to device specific sites.
Users can bookmark your site to create an icon on their home screen.
If your app doesn't depend on a remote connection, you can also just do everything in Javascript and the user can use your app offline.

How can I determine if an Android app is built with a web view?

I am new with Android programming and I am investigation the various approaches to built an app. Right now I am learning native app development using Eclipse and ADT but I also wish to look at webviews and their possibilities. Either done directly using Eclipse/ADT or via tools such as PhoneGap.
I know the pros and cons of webviews, but to better learn under what circumstances they are appropriate and likewise where they fail, I would like to analyze various existing apps and check if they are built upon a webview or programmed natively.
The thing is that I sometimes have a feeling that a given app is a webview because the look and feel is a bit different, but on the other hand perhaps the developers simply chose that look for some reason.
So, can I somehow determine if an app is made from a webview?
Try the following option that exist in different phones like S3:
Go to: "setting" -> "Developer options" -> check "show layoutboundaries"
I think that if the app is done native, the boundaries will be displayed for all the objects, while if it is a webview, no boundaries are displayed.
hope that will help...
Without too much trouble, you can look inside the apk and determine if the app uses WebView:
A. find the apk:
Installed apps are on your Android device in the folder /data/app and has domain-style filenames
/system/app has android apks
B1. If the Android device where the apk is installed is rooted, you can explore the apk on the device using for example the app Solid Explorer.
B2. Alternatively, you can enable debug on your Android device and copy the apk to a computer using adb (apks are actually zip archives.)
C. Then for a WebView app:
C1. Inside the apk, in folder assets, there are typically files with .html extension. These are Web pages displayed in the WebView.
C2. Inside the apk, in file /res/layout/main.xml (or perhaps views by other names with .xml extension), the phrase "WebView" is used.
Many slow apps are in fact not WebViews :)
If you have the source code to the app, look at the source code.
If you do not have the source code for the app, see if it has an About menu or something that indicates what they used, or see if the Web site for the app discloses how they wrote it.
I would venture that 95% or more of Android apps are native. Of the remaining 5%, the vast majority that use WebView do so to simply wrap an existing Web site but have it "be an app" for marketing purposes. While PhoneGap is a very slick tool, IMHO only a small percentage of Android apps on the Market use it or similar WebView-based technologies (e.g., Rhodes). That percentage will likely grow over the next few years, particularly as people use PhoneGap to do cross-platform development, or wrap an HTML5 Web app for offline use.
This works for me:
Install & open the app
Uninstall WebView by running adb uninstall com.google.android.webview
If the app closes after uninstalling WebView then it's using WebView
I'm assuming that you have an updated version of WebView and not the stock version that comes pre-installed on the device
To check if WebView has been updated run adb shell dumpsys package com.google.android.webview | grep versionName and there should be two different versions, one is the current version and the other is the stock version.
A certain way (but perhaps more complicated) is to root the device and install a Proxy (like https://play.google.com/store/apps/details?id=org.proxydroid&hl=en). Then you can observe HTTP traffic and try to determine if the app is using a WebView.

Showcasing Android app on a website

I have an app in Android Market which is a standalone app that's essentially a full conduit to an SQLite Database(add, change, delete, inquiry). Some of my potential clients have asked to see a sample of my work, but they don't have an Android device.
Other than just showing them screenshots etc., is there a way I could have them go to a website where they can actually run it & check it out.
I'm thinking there would be a programming element involved (convert app to a mobile website essentially?), hence posted this question here.
Not quite sure where to get started. Any help would be appreciated.
You can use one of the patterns like MVC/MVP/MVVM to create your core library and then develop additional UI variants for different clients: Android, java applet etc.
Alternatively you can develop a mobile web site as you suggested and use simple android app to navigate built-in browser to it. This might be somewhat transparent to most users. I think Android MSN client uses such an approach.
I see 2 relatively easy options.
Give them an .apk designed to only
run on the emulator (you can check
the ID, the emulator ID is 00000...)
and they can boot up an emulator and
run it. If you're worried about them
reverse engineering your .apk you
probably shouldn't go down this
route. Or if you don't want them to
have to install the emulator
Set up a virtual machine and let
your clients remote desktop into it.
Give them permissions to only run
the emulator or however you want to
set it up

Categories

Resources