how to produce android app

Note: previous activities were too old to reload, and they never really worked anyway, so am starting all over again...

background:

d/l new Android Studio

starting from

YouTube video: Creating Simple Android Apps

here goes:

adb.exe is obsolete C:\Users\wendell\AppData\Local\Android\sdk\platform-tools\adb.exe

and after several debugger restarts, it seems to work:

Build -> Build APK

find . -name "*.apk" -ls wendell@home: /cygdrive/c/Users/wendell/Documents/android/angela/app/build/outputs/apk/debug/app-debug.apk

key

is on home laptop:

    C:/Users/wendell/Documents/android/key/

Note: there is a keystore password and a key password.

Ok, here goes:

Build -> Generate Signed APK
    -> APK
    -> Next
    < fill in keystore loc, keystore pw, key alias, key pw >

    -> Next
    -> release

    Signature Version: V1 (jar)

Destination folder: D:/Users/wendell/Documents/android/angela/app

    -> Finish

and there is:

    wendell@home:/cygdrive/c/Users/wendell/Documents/android/angela/app/release
    > ll
    total 1373
    -rwx------+ 1 wendell None 1404616 Oct 28 21:14 app-release.apk
    -rwx------+ 1 wendell None     234 Oct 28 21:14 output.json

and over on webfaction:

the (old) wendell dir:

    /home/wendell/webapps/htdocs
    02:01:40 htdocs $ ll
    -rwxr-xr-x  1 wendell wendell 3899451 Oct 29  2017 angie-map1.apk*
    -rwxr--r--  1 wendell wendell 3899451 Oct 25  2017 app-release.apk*
    -rw-r--r--  1 wendell wendell     450 Oct 25  2017 index.html

and back on laptop:

    wendell@home:/cygdrive/c/Users/wendell/Documents/android/angela/app/release
    > scp app-release.apk  wendell@ilikecarrots.com:webapps/htdocs

then, on webfactional:

    chmod 755 app-release.apk

and the url is:

    http://wendell.webfactional.com/

on android

Setting -> Security -> Unknown Sources -> ON

Using Google browser:

-> http://wendell.webfactional.com/ -> app-resource

Then, when download completes: in window/panel: 'Do you want to download "app-release.apk" again'

click on the NAME, not the DOWNLOAD

and it works!!!

the icon

wendell@home:/cygdrive/c/Users/wendell/Documents/android/angela/app/src/main/res/drawable

ll total 32 -rw-r--r--+ 1 wendell None 21322 Oct 28 22:55 akt_96x96.png -rwx------+ 1 wendell None 5776 Oct 27 19:34 ic_launcher_background.xml

now, is it reproducable:

Problem: upgrade doesn't change d/l'ed app!

Will try this:

Build -> Make Module 'app'
(seems to have done something; Make is now not-selectable)
Build Bundles/APK -> Build APK

Problem: android:icon="@drawable/ic_launcher_background" Solution: drawable dir CANNOT have ANY file named .ico in it.

Possible solution: EDIT build.gradle (Module app)

        versionCode 2
        versionName "1.1"

Somewhat success: Button is now "Add 4"

10/30/2019 9:10pm:

in Android SDK (windows):

then: in Android SDK (menus):
Build -> Clean Project
Build -> Rebuild Project
Build -> Make Project
Build -> Make Module 'app'
Build -> Build Bundle(s) / APK(s) -> Build APK(s)
Build -> Generate Signed Bundle / APK -> Build APK(s)

in terminal window:

    cd /cygdrive/c/Users/wendell/Documents/android/angela/app/release
    ./push.sh

in webfaction:
???

on phone:
download and install
(takes 2 tries)

9:25 pm:
version 7
in layout window:
clear all constraints set all constraints to center horizontal and vertical

starting all over -- 11/3/2019 10:36 EDT

start project:

File -> New > New Project
Name: Angels2
Minimum API Level "API:24: Android 7.0 (Nougat)  <<< NEW

the only edit:

activity_main.xml: Hello Angela!

then:

Build -> Make Project
Build -> Make Module 'app'
Build -> Build Bundle(s) / APK(s) -> Build APK(s)
Build -> Generate Signed Bundle / APK -> Build APK(s)

app is in:

    wendell@home:/cygdrive/c/Users/wendell/Documents/android/Angela2/app/release

and after release and DOUBLE download/"install":
looks good! ; Hello msg is in center..

on webfaction: Answer extracted from comments which worked. Ensure the Content-Type is set to application/vnd.android.package-archive

<a href="http://wendell.webfactional.com/app-release.apk" download>app-release</a>

on laptop:

wendell@home:/cygdrive/c/Users/wendell/Documents/android
> cp angela/app/src/main/res/drawable/akt_96x96.png  Angela2/app/src/main/res/drawable/

butterfield video #4 -- 11/3/2019 10:37 PM EDT

get jdbc from: https://jdbc.postgresql.org/download.html#current

put it to android/postgresql/...

create New Projet (Angela3)

colors: app -> res -> values -> colors.xml icon: app -> manifests -> AndroidManifest.xml

wendell@home:/cygdrive/c/Users/wendell/Documents/android

cp Angela2/app/src/main/res/drawable/akt_96x96.png Angela3/app/src/main/res/drawable/akt_96x96.png

app -> New -> module -> Import JAR (?)

Gradle Scripts -> build.gradle (Module app) ... EDIT

I inserted:

compile project(':postgresql-42.2.8.jar')

WOULD NOT COMPILE with the above 'compile' statement...

permission .. INTERNET

11/7/2019

cat java_time_Duration.txt

attempte 1. someone's java lib:

https://github.com/JakeWharton/ThreeTenABP xxx-310 NOPE.

attempt 2

https://stackoverflow.com/questions/52996714/unable-to-import-java-time-duration-in-periodicworkrequest-class-workmanager

use sdk 26 or higher...

Make sure that compileSdkVersion is set to 26 or higher because java.time.Duration is available only on API 26+. This won't affect the ability to run your app on devices with a lower API level.

----------- Angela4

copy over all source files, then...

wendell@home:/cygdrive/c/Users/wendell/Documents/android
> cp -r Angela3/postgresql-42.2.8/ Angela4

wendell@home:/cygdrive/c/Users/wendell/Documents/android
> cp Angela3/app/src/main/res/drawable/akt_96x96.png Angela4/app/src/main/res/drawable/

wendell@home:/cygdrive/c/Users/wendell/Documents/android
> cp Angela3/app/src/main/java/DbStrings.java  Angela4/app/src/main/java/
wendell@home:/cygdrive/c/Users/wendell/Documents/android

> cp Angela3/app/src/main/java/ItemAdapter.java  Angela4/app/src/main/java/
wendell@home:/cygdrive/c/Users/wendell/Documents/android

wendell@home:/cygdrive/c/Users/wendell/Documents/android
> cp -r Angela4/postgresql-42.2.8 Angela4/app/libs/

NOPE. emulator didn't run

SOLVED: used CORRECT version of postgres jar file. it MUST be the one built for Java7!!!

Yipee!!! it worked!

incr version to 8 or 1.8

AFTER another build, copy over the push:

wendell@home:/cygdrive/c/Users/wendell/Documents/android
> cp Angela2/app/release/push.sh Angela3/app/release/

and go change the name:

cd Angela2/app/release/push.sh Angela3/app/release/
vim push.sh
    ...app-angels3.apk

and then on webfaction:

cd webapps/htdocs
vim index.html
   <as necessary>
chmod a+r *.apk  # <<<<< don't forget

and go to http://wendell.webfactional.com

going BACK to udacity intro...

d/l and try to run ud851-sunshine Solution.1

debug by emulator:

d/l from somewhere: emulator-windows-4848055.zip

IMPORTANT: AVD manager -> Verify Configuration -> Emulated Performance: Graphics -> Software - GLES 2.0
(not Hardware or Automatic)

debug on phone:

explained here: https://developer.android.com/studio/run/device.html

Settings -> About Phone -> ??? (at bottom?)
-> (7 times, just click)
Phone says "You are a developer"!!!

and for Windows driver...

Android Debug Bridge (ADB):
home laptop is Windows 8.1 (have NOT installed driver)
here goes...

Tools -> SDK Manager -> Android SDK -> SDK Tools -> Google USB Driver
was not checked...
Downloaded and installed.

NOT: POSTPONED actually connecting laptop to phone using usb (for now)

Nope. onscreen (windows) emulator started...

Tried: Run -> Debug app
no difference

Return to the main Settings menu to find Developer options at the bottom. In the Developer options menu, scroll down and enable USB debugging.

Yipee!!!, app shows up on phone!

possibly useful layout lab: https://codelabs.developers.google.com/codelabs/constraint-layout/#0

Ok, have complseted Exercise 1 [1..26]

PROBLEM: .zip file was OLD, git seemed better:

    git clone https://github.com/udacity/ud851-Exercises.git

Yes, git repo looks better (has files referenced in video)...

Manually identify git.exe:

Git Configuration...

Path to Git executable:  C:\cygwin64\bin\git.exe

Git version is 2.29.0

and -> Rebuild Project just to see what will happen...

to fix (?) T03-01:

> cp T03.02-Solution-ViewHolder/app/src/main/res/layout/number_list_item.xml T03.01-Solution-RecyclerViewLayout/app/src/main/res/layout/

11/19/2019: udacity lesson as downloadable app

1) edit AndroidManifest.xml for icon

    android:icon="@drawable/akt_96x96"

2) EDIT build.gradle (Module app)

        applicationId "com.ilikecarrots.wendell.angela3"

        targetSdkVersion 28

        versionCode: 9
        versionName: "1.9"

            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

and

wendell@home:/cygdrive/c/Users/wendell/Documents/android/uda_git/ud851-Exercises/Lesson03-Green-Recycler-View

    mkdir T03.01-Solution-RecyclerViewLayout/app/src/main/res/drawable
    cp ../../../Angela3/app/src/main/res/drawable/akt_96x96.png T03.01-Solution-RecyclerViewLayout/app/src/main/res/drawable

3) Build -> Make Module 'app'

4) Build -> Build Bundles/APK -> Build APK

    -> APK
    -> Next
    < fill in keystore loc, keystore pw, key alias, key pw >

    -> Next
    -> release

    Signature Version: V1 (jar)

then:

    cp ../../../Angela3/app/release/push.sh  T03.01-Solution-RecyclerViewLayout/app/release/

5) EDIT htdocs/index.html as appropriate

6) download to phone

udacity lesson t03.01 RecyclerView works as desired!

Hmm..., app icon on phone is now named "RecyclerView".

7) make backup/print copies

wendell@home:/cygdrive/c/Users/wendell/Documents/android

    . for_bashrc.sh
    cd uda_git/ud851-Exercises/Lesson03-Green-Recycler-View
    andback T03.01-Solution-RecyclerViewLayout

T03.01-Solution-RecyclerViewLayout/app/src/main/AndroidManifest.xml
T03.01-Solution-RecyclerViewLayout/app/src/main/java/com/example/android/recyclerview/ColorUtils.java
T03.01-Solution-RecyclerViewLayout/app/src/main/java/com/example/android/recyclerview/GreenAdapter.java
T03.01-Solution-RecyclerViewLayout/app/src/main/java/com/example/android/recyclerview/MainActivity.java
T03.01-Solution-RecyclerViewLayout/app/src/main/res/layout/activity_main.xml
T03.01-Solution-RecyclerViewLayout/app/src/main/res/layout/number_list_item.xml
T03.01-Solution-RecyclerViewLayout/app/src/main/res/values/colors.xml
T03.01-Solution-RecyclerViewLayout/app/src/main/res/values/dimens.xml
T03.01-Solution-RecyclerViewLayout/app/src/main/res/values/strings.xml
T03.01-Solution-RecyclerViewLayout/app/src/main/res/values/styles.xml
T03.01-Solution-RecyclerViewLayout/app/src/main/res/values-w820dp/dimens.xml

back_T03.01-Solution-RecyclerViewLayout_Nov_19_2242.tgz                          100% 5579   129.8KB/s   00:00

mapbox 11/22/2019: (NOW MOVED to its own page)

after several edits got mapbox routing to work from here:

https://docs.mapbox.com/help/tutorials/android-navigation-sdk/

colors

these colors:

    "colorPrimary"
    "colorPrimaryDark"
    "colorAccent"

are not explicity used, but are prob. in this theme:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

these colors:

    "mapboxWhite"
    "mapboxBlue"
    "mapboxPink"
    "mapboxYellow"

are used in:

<style name="NavigationMapRoute">

as:

<item name="routeColor">@color/mapboxBlue</item>
<item name="routeModerateCongestionColor">@color/mapboxYellow</item>
<item name="routeSevereCongestionColor">@color/mapboxPink</item>
<item name="routeShieldColor">@color/mapboxWhite</item>

these colors:

    "mapboxGrayLight"

is used in:

        android:background="@color/mapboxGrayLight"
./AngelaNav1/app/src/main/res/layout/activity_main.xml

seems to be color of Start Navigation button when disabled

these colors:

    "mapboxRed"

apparently unused; could have been used in SevereCongestionColor but replaced with Pink

TODO:

done (except for nav button):

colors.xml:
    <!-- carrot colors -->
    <color name="colorPrimary">#F90</color>
    <color name="colorPrimaryDark">#Fc6</color>
    <color name="colorAccent">#9f6</color>

    <color name="carrotOrange">#F90</color>
    <color name="carrotLightOrange">#Fc6</color>
    <color name="carrotDarkGreen">#690</color>
    <color name="carrotLightGreen">#9f6</color>

some notes on android app styles:

geojson in mapbox

https://docs.mapbox.com/android/maps/overview/data-driven-styling/

section Data-Driven Styling says:

mapboxMap.getStyle(new Style.OnStyleLoaded() {
    @Override
    public void onStyleLoaded(@NonNull Style style) {

        try {
            URI geoJsonUrl = new URI("https://url-to-geojson-file.geojson");
            GeoJsonSource geoJsonSource = new GeoJsonSource("geojson-source", geoJsonUrl);
            style.addSource(geoJsonSource);
        } catch (URISyntaxException exception) {
            Log.d(TAG, exception);
        }
    }
});

time lapse

https://docs.mapbox.com/android/maps/examples/add-an-image-source-with-time-lapse/

and in git:

https://github.com/mapbox/mapbox-android-demo/blob/master/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/styles/ImageSourceTimeLapseActivity.java

https://github.com/mapbox/mapbox-android-demo/blob/master/MapboxAndroidDemo/src/main/res/values/colors.xml

async operations

geojson plugin: https://blog.mapbox.com/new-geojson-plugin-for-android-862124f9d24b

geojson docs: https://docs.mapbox.com/mapbox-gl-js/api/#geojsonsource

this one looks ok, but web (not android): "Add live realtime data": https://docs.mapbox.com/mapbox-gl-js/example/live-geojson/

direct fetch of JSON from MySQL: https://www.simplifiedcoding.net/json-parsing-in-android/

notes from mapbox doc pages

1) seems good place to start:

The Places Plugin for Android: https://docs.mapbox.com/android/plugins/overview/places/

1) Tutorials: https://docs.mapbox.com/help/tutorials/

Use Mapbox with OpenLayers: https://docs.mapbox.com/help/tutorials/mapbox-with-openlayers/

Add OpenStreetMap data to your Mapbox project: https://docs.mapbox.com/help/tutorials/overpass-turbo/

Build a store locator using Mapbox GL JS: https://docs.mapbox.com/help/tutorials/building-a-store-locator/

Get started with Mapbox GL JS expressions: https://docs.mapbox.com/help/tutorials/mapbox-gl-js-expressions/

Add custom markers in Mapbox GL JS: https://docs.mapbox.com/help/tutorials/custom-markers-gl-js/

Local search with the Geocoding API: https://docs.mapbox.com/help/tutorials/local-search-geocoding-api/

2) examples & blog

animated_marker.java: https://docs.mapbox.com/android/maps/examples/animate-marker-position/

icon_updated_from_api_source.java: https://docs.mapbox.com/android/maps/examples/api-response-icon-update/

New GeoJSON plugin for Android: https://blog.mapbox.com/new-geojson-plugin-for-android-862124f9d24b

3) general android:

How To Fetch Data From Web API In Android: https://www.c-sharpcorner.com/UploadFile/9ab05e/how-to-fetch-data-from-web-api-in-android/

openweather.org

hava account:

openweather seems rather lame: has android app possibly pointless: only data avail for free is current wx and maps 1.0 * hourly forecast cost $180/mo

possible source code for (the rather lame) app: https://www.survivingwithandroid.com/android-openweathermap-app-weather-app/#Android_Weather_App

another (possibly different) source code, but same source for wx: https://www.androdocs.com/java/creating-an-android-weather-app-using-java.html

survey of weather APIs: https://www.survivingwithandroid.com/4-free-weather-open-api-to-develop-android-apps/

Weather Underground!

https://www.wunderground.com/

z...x

API ceased operation at end of 2018.

Dark Sky

https://darksky.net/dev/docs/libraries

z...X

key: b42976a26ffdb2d940c84a4744bffc4c

possible app: https://github.com/kevinzetterstrom/forecast-android

> cd android/
> mkdir darksky
> cd darksky/
> git clone https://github.com/kevinzetterstrom/forecast-android.git

README.md says:

### Forecast API Registration
In order to use the Forecast API, you will need to
[register](https://developer.forecast.io)
as developer with them, and obtain an API key

which is darksky, so should be good...

Packages to install:
- Android SDK Platform 24 (platforms;android-24)

Preparing "Install Android SDK Platform 24 (revision: 2)".
Downloading https://dl.google.com/android/repository/platform-24_r02.zip
"Install Android SDK Platform 24 (revision: 2)" ready.
Installing Android SDK Platform 24 in C:\Users\wendell\AppData\Local\Android\Sdk\platforms\android-24
"Install Android SDK Platform 24 (revision: 2)" complete.
"Install Android SDK Platform 24 (revision: 2)" finished.

and then:

ERROR: failed to find Build Tools revision 24.0.2
Install Build Tools 24.0.2 and sync project
Upgrade plugin to version 3.5.2 and sync project

and lots of git/sync going on...

what doesn't work: * -> Run, app never starts, seems to display 'wait' circle forever

what works: set some breakpoints -> Run, -> Debug 'app' * use fn+f8 to (allegedly) step over

tomtom (12/29/2019)

following instructions from (print these out): https://developer.tomtom.com/maps-android-sdk/downloads

    mkdir tomtom
    git clone https://github.com/tomtom-international/maps-sdk-for-android-examples.git

then open up SDK

Unexpected error while executing: am start -n "com.tomtom.sdk.examples/com.tomtom.online.sdk.samples.ktx.SplashActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Error while Launching activity

Run log shows:

D/EGL_emulation: eglMakeCurrent: 0xa4810280: ver 2 0 (tinfo 0x956bfe20)
E/mbgl: {om.sdk.examples}[Style]: Failed to load tile 4/7/5=>4 for source tomtom-flow-vector-relative: HTTP status code 403

error check:

    https://api.tomtom.com/map/1/tile/basic/main/0/0/0.png?key=DwDOAQnaRA3Z83ESzw6vwtyxt0dyopG4

Key inactive;

Created new key:

    https://api.tomtom.com/map/1/tile/basic/main/0/0/0.png?key=E0BXTj8qVzToTXyrAmqzUFzMTNkib6F5

that key works for a sample url.

BUT nothing in the app.

>>>>>>>>>>> GAVE UP on tomtom