I have an android application that's a "link" to a magazine website.
The activity of the application would be the magazine website itself.
I've made a widget for it and I run a service that as one sole purpose: to detect when a new magazine is online. When the service detects it changes the widget icon.
Now my doubt is how can I detect a new magazine. I was thinking about download a file from the website every 6 hours and compare the version of the last magazine (I may start with 0 as a local variable for the application and compare with the number provided by the document downloaded).
Is there a better way to do it?
It depends what you consider to be a "change". Assuming you want to detect any changes, download the magazine homepage/other file and perform an MD5 or similar hash on it. Store the hash.
Next time you do a download, you hash it again then compare hashes. If the hashes are identical, the page is unchanged. The benefit of the hash is the reduced storage requirements - you only need to save a handful of bytes, not a whole document.
Be aware, however, that most pages are NOT static - imagine a page with a clock in the corner or any dynamic content - in this scenario, your page will always appear to be different.
For some well-run sites and servers, you may be able to look at the HTTP headers to get information about when the page was created/modified/is set to expire. This won't be provided by everyone and can sometimes just be plain wrong.
The ideal solution is to find one particular page (or part of a page) which will onlu change once with every new issue - then you can just keep checking that one thing. An example of this might be a link that always points at the latest issue or the url for the main image which changes with each issue.
Of course, if the magazines are willing to help, they could expose the information to you in a number of ways from a simple file with just an issue number inside to a full-on webservice.
Edit: Assuming multiple magazines under your control, I'd suggest you have a single page that returns a list of the latest issues for each magazine in a readily parsable format (JSON, XML). This list could be static if issues are infrequent/a very manual process - in which case, edit it by hand. Even better would be a simple database table which is read to generate the list - This way you can have a nice UI to update it and allow someone else to maintain it without giving them access to the server file system.
I'd also suggest that you assign a truly unique id/key to each magazine and to each issue of that magazine - so that in future, you can add other functionality like downloading locally for offline reading / syncing back issues.
Related
I have been looking at similar questions on this website and Im looking to try to get certain pieces of information from a .xml file on a website that I then duplicate for each individual lake. I am trying to make something that will be able to get the current water level for each of these lakes. I found this tool that can generate .xml of the data but I dont know how to have flutter read that and update it every so often if that makes sense.
https://waterservices.usgs.gov/rest/DV-Test-Tool.html
I was testing this site using Neosho River with the Site number: 07179500. This gives me the following url that seems to contain relevant updated information such as the current discharge rate.
https://waterservices.usgs.gov/nwis/dv/?format=waterml,2.0&sites=07179500&siteStatus=all
How can I have it pull information like this and then re-check every x time to update the current water level etc? I was looking at json? but most guides I found use a file you upload and not a website.
Additionally, there are several other links that may be helpful and might have a better type of data
https://waterservices.usgs.gov/rest/
https://waterservices.usgs.gov/rest/DV-Service.html
https://help.waterdata.usgs.gov/faq/automated-retrievals
https://waterdata.usgs.gov/nwis/dvstat?&site_no=07179500&agency_cd=USGS&por_07179500_55652=92891,00060,55652,1938-10-01,2021-11-21&stat_cds=mean_va&referred_module=sw&format=html_table
https://waterdata.usgs.gov/nc/nwis/uv?cb_00062=on&format=html&site_no=02098197&period=&begin_date=2022-02-28&end_date=2022-03-01
https://www.swt-wc.usace.army.mil/
If flutter can not do this is there something else I can use to work with flutter?
My question will be really long but I encourage you to read through everything as it will be used for an honest, good cause. Or you can skip to the highlighted questions part.
Let me introduce myself first, I am an independent web application developer here in the Philippines and I work for a non-profit organization where we help less fortunate people by providing IT solutions and services for free. I have a working web application that has dynamic registration forms where users can enter their data online. I developed this application with responsive UI using bootstrap's grid system. But being here in the Philippines, there are remote areas where the target clients don't have access to the internet 24/7, and bringing laptop or desktop computers is a pain because of the terrain and rivers that we need to cross to reach these remote areas.
Now, together with my team, we are thinking of a way to use our mobile phones, mostly androids to create a mobile app version of our web application. Where it can download the registration form (html) when we are connected and then use it even without internet connection.
Ideally the situation should be:
1. Launch the app from my mobile, and while connected to the internet, download the html forms needed from our web application.
2. Travel to remote areas, use the mobile application to encode the native's information offline. (I heard its possible to save it locally to sqlite db)
3. Go back to the headquarters and sync with the online web application to pass all the information gathered and thats it.
Having said all that, I have 3 questions:
1. What should I use to create a mobile app that can display html forms downloaded from the internet?
2. How can I save the data locally (within the phone)? I heard about sqlite db but I am not sure if it will work with my situation.
3. How can I sync the locally saved data to the online web application?
This is more like a survey application. You dont need the html here. You design your question definitions in xml or json. You may have multiple types of question like Text Answer Question, Single Choice Multiple Option Question, Multiple Choice Multiple Option question, Image Question, QR Code Question, GPS Coordinate Question etc etc. You design these questions in json or xml and put them in server. For example
{
questionSetName: "Question Set 1",
question:[{
questionText: "What is your name ?",
questionType: "TextAnswer"
},
{
questionText: "Which one console below do you own ?",
questionType: "SingleChoiceMultipleOption",
options:["PS4", "XBox", "Steam Console"]
}]
}
Now for your mobile client:
When online user will want to download questions for later offline surveys. so user send a request to server for available question sets. then will pull these file from server (in case of android through some HttpClient like OkHttpClient) and put them in sd card. The server will implement rest apis for question lists and downloading individual question sets.
The application will check if files are present in a certain folder (your app designated folder) in the sdcard. The file names will be the list of the questions.It will parse the json or xml and render question windows accordingly, for example for text question a label with the question text and a text box for answer, for single choice multiple options a set of option buttons, for image questions open the mobile camera etc.
When filling up (answering) the questions you save the answers and question number and flush them in a json file. and put the answer files in another directory (you need some sort of identification).
later on upload the answer files to server.
The server side will require the following rest apis :
1. List of Question Sets of a user (from db ??)
2. An api (webservice) to download a set of questions.
3. An api to upload an answer sheet for a question.
4. user management of course.
Hope this helps.
I am in process of designing an Android App :a poetry application, which would
a. display the poetry
b. audio controls - start, stop, restart, move for poetry
There are currently collection of 25 poems and it may update in future.
One way is to
Approach 1. Make a static app with all available content and update the app regulary with newer contents
Advantage: Easy to develop as everything is static
Disadvantage: App would be heavy as it would contain lot of content.
Approach 2 Is it possible to put content seperately from the app,ex. app is installed and the content is placed on external storage memory. Using this mechanism, everytime there is a update, the content can be replaced with new contents (approach 2 = a very light weight player capable of showing content (may be in form of image) and audio capabilities + a separate location where content (images+mp3) are placed)
Approach 3. Make a hybrid app, as the user request for a content , the content is downloaded at run time and played using android audio capabilites.
Approach 4. Make pure HTML5 based web app.
Is there any other possibility ? Which option is more beneficial from user experience point of view.
Many thanks in advance
I would go with Approach 2,5, it is a mix of Approach 2 and Approach 3 where you save the downloaded file to a database so you do not download the same file multiple times and then play it.
Some clarification, as I understood Approach 2 would only have more poems if there was a Google Play update and Approach 3 was streaming. Using Approach 2,5 you will get the storage from Approach 2 and the playback from Approach 3.
Update: The term I was looking for was to synchronize data. Approach 2,5 is really just a way to download for instance a JSON and parse it then download the files and put it in a database where the app later can access it. With this approach the user need not update the app and if you want to remove a poem that is also possible.
Short version at the bottom
I'm working on an android app for a computer game, Heroes Of Newerth. A part of the apps functionality is to list all the heroes in the game. Each hero has:
a short description
a few stats(faction and primary attribute)
an icon
4 spells, which also has:
a short description
a few stats (mana cost, difference in ranks, etc.)
an icon.
There are approximately 110 heroes, which means I have about 500 sets of descriptions and stats.
I made a working version of the app. I downloaded all the images and put them in the drawable folder (note, this was 500 images), and created a Hero Enum which stored name, faction and primary attribute. Obviously, this was a bad idea, as it was horrible looking, and hard to extend to storing the rest of the data.
I have though about using a database, but as I don't have any experience with databases, I'm not really sure as how to do this, especially in Android. I looked it up, and it seems I need to initialize the database on the phone, which means I have to get that data from somewhere - which, again, means I'm back to square one.
I have never worked with this much data in a programming project, and have no idea for how to save it all. As if this is not enough, the game developer, S2 Games, releases new heroes with only weeks in between. As I wouldn't want to update one of my apps every other week, I want the app to be able to update itself with the new data. The best way I see this in my head is you download the app, either with a database of the current heroes, or without any, and the app checks each friday(patches are released on fridays) if the app is up to date. If not, update the database(with text and icons).
Short version
I want to save a few thousand strings, some formated in a special way(unless I can to this afterwards), and about 500 icons. How should I approach this?
Note: I know this was a really bad question, with a horrible structure, but I've been stuck here for weeks, and I couldn't get myself to ask someone, I really need help here!
well it's very recommended that you use sql and databases . you could go to w3schools for the basics .
if you don't want to use DB (or don't have time) , you can store all the data in xml files , and then parse them all . the images should never be part of the DB (or the xml files) , since they cause a bad performance while moving between items.put their names/paths instead .
if the images take a lot of space , consider using google expansion library .
this should be an easy one for whoever published Android Apps before...
Here is my situation:
I'm trying to develop a "city guide" app and I was wondering if my idea of working with .XML files to structure my data (the client provided a .PDF file with pictures, address, tel. no, websites, opening hours of the different destinations) is the best way to go.
I was hoping to be able to write this app as an "interpreter" for this type of .XML and then easily include other cities or destinations in a city by updating that input XML file.
So this is not a technical question, I know how to pull this off, the question is if this is a good way to go? How do you keep an app easily up to date? Would a altered XML trigger a Market wide update notification ?
My research lead me to believe that this is a comfortable way to update a published Android Market app (prior to this inquiry I consulted:
http://developer.android.com/guide/publishing/publishing.html
All helpful hints and suggestions will be greatly appreciated.
Regards,
Veo.
Once I developed such kind of an app that had to contain the whole information in itself. I structured it in SQLite database that I was shipping along with the application. The file was not directly readable (or at least easy to read) from the assets folder, but every time when the file was altered I copied the sqlite file to the application storage and used it as ordinary application database. The cool thing is that this way I did not have to pay for the parsing of xml every time the application ran.
Several notes here:
My database grew too big and I had to split it in files of 1MB, because this is the limit for a file in the asset folder. For more info see here:
The database update mechanism with the database version still worked well.
When you create the database manually you need to take into account that Android expects one system table to exist in it (it is automatically created if the database is created in Android code). Basically see this answer here for more info on that.