Android Tutorial ? Retrieving 2 JSON data feeds from an online server (Wear OS watch face) - Newer developers

Hello All
Here we have a simple example of how you use corwin42s WatchFace Library. The WatchFace library is extremely simple to use, corwin42 has done a great job wrapping it, thank you.

In this example we not only show the battery level, time and date using a custom font, but we also load JSON data from the internet to display information.

I'm not sure how long the JSON feed will stay up, it maybe only months or several years. So I've decided to download the 2 current JSON feed files and attached them to this post for future reference, just to be on the safe side.

Edit:
Removed LEDCoronavirus.zip - Original file (2 downstairs)
LEDCoronavirus_V1.0.0.1.zip - Optimised and removed unnecessary code, tidied up the Manifest.

Libraries needed:


App running on a LG smartwatch


Watch face with flashing seconds dots
Tap the bottom 2 lines to update the figures



Settings screen


Color settings


Country selection


Color picker



Enjoy...
 

Attachments

  • JSON.zip
    13.1 KB · Views: 565
  • LEDCoronavirus_V1.0.0.1.zip
    111 KB · Views: 578
Last edited:

MikeFree

Member
Trying to run the example .. but i get following message:

error in line: 22 (LEDCorona)
Private LEDWFManager As WFManager

which Library has to add ?
 

Peter Simpson

Expert
Licensed User
Longtime User
which Library has to add ?

Hello,
I can confirm that all you need are the libraries in the screenshot snip below. You need the WFManager from the link below.




Enjoy...
 

MikeFree

Member
sorry to say running still into some errors ... can anyone help? see attached files
 

Attachments

  • 2020-06-01 13_27_29-B4A_error_02.jpg
    8.8 KB · Views: 358
  • 2020-06-01 13_28_58-B4A_error_01.jpg
    140.9 KB · Views: 377

Peter Simpson

Expert
Licensed User
Longtime User
sorry to say running still into some errors ... can anyone help? see attached files

Start B4A, go to the Tools > SDK Manager, search for 'androidx.constraintlayout', check/tick the box for version 1.1.3. Once the once that has been installed, try running the project again...

 

MikeFree

Member
i run your tipp ... "Maven" error no longer pops up.
But i'm getting Error on Line 89:

Fehler in Zeile: 89 (DigitalWatchFace)
Dim TimePaint, SecondPaint, DatePaint As ABPaint

maybe you can explain the reason?
 

Attachments

  • 2020-06-07 19_14_15_Compiling_Error.jpg
    151.6 KB · Views: 363
  • 2020-06-07 19_14_15_Compiling_Error_2.jpg
    149.7 KB · Views: 342

Peter Simpson

Expert
Licensed User
Longtime User
@MikeFree STOP STOP STOP, you have gotten your post mixed up. Basically you are posting in the wrong thread.
The screenshots that you provided are for the original library tutorial by @corwin42 and is not for my tutorial in this thread.

You are in fact using the original code from the link below and not my code.
You should post a new question in the forum about your issue, but first read the instructions from the original post in the link below.

By the way, to FIX your issue above, you NEED to install ABExtDrawing library V1.7 from the link below.

Enjoy...
 
Last edited:

MikeFree

Member
sorry that i m writing again use recommended library ABExtDrawing but now ... again error ...
is it possible to run the program unter Android Phone and not on Android watch ?

Thanks for help.
 

Attachments

  • 2020-06-14 20_40_54-192.168.3.77 - Watchface_error.jpg
    161.4 KB · Views: 368

bonap

Member
Hallo,
sorry for my bad english.
I try to compile in Debuggingmodus the Example LED Coronavirus. When the Compiler generate the R-File, i become this Errormessages:
c:\android\tools\..\extras\b4a_remote\androidx\constraintlayout\constraintlayout\2.0.4\unpacked-constraintlayout-2.0.4\res\values\values.xml:339: error: Attribute "android:alpha" has already been defined
I take the androidx.constraintlayout:constraintlayout Version 2.0.4. Is this the Reason for the Error? What can i do?

Thank you
 

Peter Simpson

Expert
Licensed User
Longtime User
Hello @bon,
Have you installed

via B4A SDK-Manager, it assembles perfect here????????

Make sure that you have the following


Don't forget to download and use the ABExtDrawing library too.

I don't think that I made any changed after the original post, I'll compare the above attached project with my current project later when I get the chance...
 
Last edited:

bonap

Member
Hallo Peter,

thank you for your answer.
I use this:
B4X:
#Region  Project Attributes
    #ApplicationLabel: LED Corona
    #VersionCode: 1
    #VersionName: 1.0.0.1

    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
   
    #AdditionalRes: ..\resource
   
    #AdditionalJar: androidx.wear:wear
    #AdditionalJar: wearable-2.5.0.aar
    #AdditionalJar: com.google.android.wearable:wearable, ReferenceOnly
    #AdditionalJar: com.android.support:support-v4, ReferenceOnly
    #AdditionalJar: com.android.support:percent, ReferenceOnly
    #AdditionalJar: com.android.support:support-annotations, ReferenceOnly
    #AdditionalJar: com.android.support:recyclerview-v7, ReferenceOnly

    ' Copy the wear app into the mobile app resource folder
    '#CustomBuildAction: 4, C:\windows\system32\xcopy.exe, WatchfaceWear.apk ..\..\WatchfaceMobile\resource\raw\watchfacewear.apk /Y  
#End Region

download with B4a-SDK-Manager,
and this Librarys:



Whats wrong?

Thank you
 

Watchkido1

Active Member
Licensed User
Longtime User
Hi bonap

Hast du das Problem in den Griff bekommen?

Ich hab seit tagen dasselbe problem....
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…