Mobile Apps 2023W Lecture 9

From Soma-notes
Revision as of 17:02, 8 February 2023 by Soma (talk | contribs) (Created page with "==Notes== <pre> Lecture 9 --------- Key challenge this semester is design as much as implementation So...I'm going to design and build an app, and walk you all through it What websites have I been visiting? - I visit all kinds of places - I don't make bookmarks - yes there is history, but it isn't easy to view - would love the browser to eventually help direct my browsing towards things I, at a high level, want to visit rather than what is most easily in "reach...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Notes

Lecture 9
---------

Key challenge this semester is design as much as implementation
So...I'm going to design and build an app, and walk you all through it

What websites have I been visiting?
 - I visit all kinds of places
 - I don't make bookmarks
 - yes there is history, but it isn't easy to view
 - would love the browser to eventually help direct my browsing towards
   things I, at a high level, want to visit rather than what is most easily in "reach"

(Basically, how do I do more "healthy" browsing rather than "junk food" browsing)

Imagine a browser as a helpful assistant rather than a dumb app

And doing it as a mobile app would be cool because, hey, that's where I browse the most.

So what I want to do is do the simplest version of this app I can
 - not quite an MVP
 - gets access to all the info I want, can process it
 - the processing is an open-ended project, so will just do it in a minimal fashion

Why is this good for class?  It touches most everything
 - need to design a good UI
 - background processing
 - web technologies (embedded browser, maybe generating pages)
 - maybe access web services to store & retrieve info of various kinds
    - search engines?
    - get general context
 - location (for showing relevant past browsing)
 - networking

 
How do you start with this?
 - well, we already have
 - first you need to understand the tech
 - then you need to try building it
 - when you are building and you realize you don't know the tech,
   go and figure it out

We've done basic UI, embedded web browser, basic REST API

The core of this, however, is the web history
Remember, always start with your core data structures


We want the data to be persistent, queryable, and structured.  We're using a database!

SQLite is the obvious choice for a database integrated into a mobile app

So what's our initial goal
 - web browser
 - which shows the current URL
 - with the URL and other aspects of the page stored in a database on the device

So initially we'll just need the following fields in our database:
 - date/time, host, URL, page title
 - entry for every visit
    - not compact, will have lots of redundancy
    - but easy to build for now

Make sure you store & represent all the data that could be relevant in their raw form
 - can later optimize and extract important characteristics

Try for minimalism where you can
 - lowers complexity
 - try to maximize othonogonality of components, allow for component reuse

So before we do the web browser with a history, to minimize complexity what do we next need to build?
 - simple app that stores info in a local database
 - then, we build a web browser with a history in an array
 - then we build a web with history in the local database

First, how do we do databases like SQLite in android?
 - we could use built-in support for SQLite
    
 - we could use Rooms:*
    https://developer.android.com/training/data-storage/room

 - or we could use raw SQLite
    https://developer.android.com/training/data-storage/sqlite

Rooms looks much nicer!


Next, how do we get browser history? I see three approaches
 - have users browse in new app*
 - extract history from an existing browser on device
 - extract history from a cloud service

How can we know what URL we have visited?
 - we'll just remember the webviews we've visited

Stop here, on Friday we'll look at some code using the Rooms API to access a SQL database
 - note I'll be in NYC, but shouldn't have too many technical issues hopefully

On Friday we'll start however with you all telling everyone about your progress
 - would be great for you all to demo little bits of functionality that you have running

Now I'll do tutorial checkoffs, answer questions

I'm going to make T3 be with databases, T4 will be a simple web browser