I have a project for an Android app, which basically loads a certain web page (user defined), and show statistics about that page loading and files.
So basically.
I type: www.imgur.com, the app downloads the site (loads it in background, the process shouldnt be visible), and then the app shows stats like this
Javascript files: 4, load time: 0.3s, size: 30kB
Images: 12, load time: 0.7s, size: 1.5MB
etc.
I already made a few android apps, so I'm rather asking about what to look for?
My only "tip" is to try to get some browser core (like Chromium) and try to get something from it, but Im really not sure where to grasp it.
I know I could manually "download" that page, but since I need it to also process Javascript and AJAX, so it wont be that easy.
Any tips are very welcome.
Related
I have an issue with displaying an image in my web app and I can't think of any other reason but some strange cache situation. The image has the following CSS properties so its always showing a square part of the image:
object-fit: cover;
height: 100vw;
width: 100%;
Now when I test the app on my phone the image gets stretched like object-fit isn't supported by the browser. But when I test the same on my girlfriend's phone it works perfectly. Strange part is that we have the exact same phone(samsung s10e) running the same os and using the same browser(Chrome for Android) and browser version (83+). I tried reinstalling and deleting temp data from any browser installed but I can't get it to work. The app is using a web app manifest but no service worker (yet) if this helps.
If someone has any clue how to go from here please let me know.
You should clear your browser cache. Here's how...
Open chrome and click more. Click more tools then clear browsing data. Choose a time rage or all time. Check cookies and other site data and cached images and files. You can try just clearing cached images and files first but for a full clear do the other one (this one may sign you out of most sites)
Clear clear data and your done.
If it's that you want your one web page not to be cached on all browsers (supported ones only) then look into the pragma meta tag.
We are currently starting work on a project which consists of a website, plus Apps for Android, iOS and (yes) Windows phone.
The apps are identical on all three platforms, and are relatively simple, at least in theory.
They need to provide offline access to the content on the site. This is static content, so is a set of .html pages plus assets (images, css, javascript, etc.).
They need to be able to periodically update the content automatically, when an internet connection is available.
Any external links should open in the user's internet browser rather than within the app.
The app should not display any browser 'chrome' (e.g. address bar, etc.).
It seems like Cordova is a good way to go with this (though I'm open to other suggestions). However, I'm having difficulty finding any information about how to proceed.
For point 1, the way I'd imagine it working is that the app loads some form of web view pointing to file://path/to/site/index.html. Assuming the site uses relative URLs for all internal links and assets this should be sufficient to provide a fully browsable offline version of the site. The app will ship with a static export of the current site.
For point 2, I imagined that the Cordova app would occasionally run a synchornisation process, which would essentially be a number of web requests to the website's API to find out if there is new content. It would then download any new files, placing them in the file structure referred to in point 1, overwriting existing files. (For the purposes of this question, I don't care if that temporarily puts the site in an inconsistent state.)
Point 3 sounds trivial, but I'm not sure if it is. Would target="_blank" be enough? Or a bit of JavaScript to trigger some Cordova action when the link is clicked? We control the way the HTML is generated, so we can insert additional markup for offline use, if necesssary.
Can anyone offer any advice about how to handle an automatically-updating local static site in this manner? Is it even possible?
Cordova mostly does store your html files in an app and the shows the index.html (Or an other page if you define it) in an WebView.
The cool thing here is that Cordova will also provide an API to call Device APIs from JS.
Cordova does not automatically reload you html files and assets into the app. For that you would need to release a new App or you simply reload just the Data in your App and you control all of that in JavaScript.
If you do not need any Device APIs I would recommend you take a look at ServiceWorkers for caching and reloading files.
With some HTML Tags you can also create a really App like behavior after pressing "Add to homescreen".
Best Regards
Marc
I am working on a difference game (for android).
The apk size becomes large when I add too many levels(say 100+). I have optimized all images, etc. However the size become more than 10 Mb.
Is there any way to allow users to incrementally download 10 image files (png) at each time.
Something like only first 10 images with app install and then allowing incremental 10 images with each button click from within the app.
If I try to do it by downloading from a web server, what will I need to implement (is it async task or can I do it with something simple). In such cases, is http allowed or I need https.
I'd personally rather download that 10MB once and for all instead of downloading those additional images every time I play the game; it could be expensive to download all that data. You could of course cache them, so I don't have to download them again. And you could foreward-download an entire level of images at a time (level2.zip). But what if I suddenly beat my own high score and proceed to a new level ... and I don't have a very good internet connection at that particular moment? If you're ruining my gaming experience, I'll delete your app and give it a bad review immediately -- and so will everyone else =)
I'd definitely recommended adding all data and not depend on the user having a fast internet connection AND is willing to pay for the download.
If you app grows too big, you should look into expansion files, but I havne't used those myself so I can't tell much more than the link:
https://developer.android.com/google/play/expansion-files.html
I have a xamarin forms project for the company I work for. I have 6000+ images used in two ways : a thumbnail page and a full size page. I have both the thumbnail image and the full size image. The thumbnail page shows 12 products at a time, but it lives in a carousel page so it could have up to 18 content pages within the carousel.
I've tried three ways of saving/accessing the images:
Including them as bundle/android resources. This works the best but takes forever to build the project and on android will mean I have to use expansion files.
Included the binary image from the database when downloading the product listing. Causes the app to crash randomly on download.
Downloading all of the files from the web. This works, but on both Android and iOS, the thumbnail screen slows to a crawl and half of the time crashes on Android.
Has anyone had to do something similar and if so, what way did you decide to go? Unfortunately, this app does have to be usable offline so I need the images local. I'm kind of in a time crunch so any help would be appreciated!!
I had similar issues someday back and understood that it won't be successful with standard Image class with such a large amount of images (no memory caching, no task queueing, etc). Then I made CachedImage. It's basically an API compatible replacement for Image with advanced caching capabilities (and some other features). You could try that.
Just remember to use:
Downsampling feature : that way image would be resized to view size to save memory
Caching feature (it's enabled by default not including StreamImageSource for which you have to provide custom cache key factory)
Use FileImageSource (app dir) or StreamImageSource (eg. from image database) with custom cache keys
https://github.com/molinch/FFImageLoading (See WIKI for docs)
I am making a network app that works with a few news sites. I have an option to view and download articles (for reading in future). There is no fast mobile internet in my country (mostly 2G with the speed up to 15 KB/sec) and my app doesn't work really well with the slow connect though it's perfect with fast connection. As I have seen from logs it can't establish the connection. When I try to open the article it doesn't load at all or goes into infinite loading. When I try to save the article it simply saves the blank file. How can I track these mistakes and catch them? And what are the correct ways of handling it?
I suppose that my code is irrelevant as it works correctly with Wi-fi. I think I simply need to add lines, not to edit them
ok, you need to manage the information very good, you need define the package size to download, you need a webservices that allow to you to manage the information one by one, for example you need design packages no more than 500kb size to download, when this package is downloaded you can show something in your mobile and continue downloading the next package in background.
500kb is only an example you need to test what is the maximum data size to download and create packages like that in your web services