skip to Main Content

I’m currently trying to wrap my head around developing WearOS watch faces for personal and company-internal use. I managed to adapt the WatchFaceKotlin example to an acceptable level for an analog watch face.

Now I’m trying to implement a digital watch face from scratch by following the Design watch faces pages on developer.android.com and scraping together missing parts from the example and wherever I can find. It’s been tedious, but workable – until now.

I think I implemented a bare bones watch face just displaying hello world. It builds & runs in the emulator, but shows a black screen.

I’m getting the following error in Logcat (line breaks added):

2023-12-14 18:58:13.029   
754-13241 
WearServices            
com.google.wear.services             
E  
[ProviderGetter]Fetched empty list of supported providers: supportedTypes = null, packageName = de.mycompany.digitalwatchface, watchFaceId = null

I’m not even sure this is the problem, but it is the only error, so…

I tried googling it every which way, but could not find anything helpful at all.

So, how do I find where this is coming from, and how to resolve it?

For completeness sake, here’s the render function in my DigitalWatchFaceCanvasRenderer:

    override fun render(
        canvas: Canvas,
        bounds: Rect,
        zonedDateTime: ZonedDateTime,
        sharedAssets: DigitalSharedAssets
    ) {
        canvas.drawColor(0x550000)

        val textPaint = Paint().apply {
            isAntiAlias = true
            textSize = 40f
            color = 0xFFFFFF
            typeface = Typeface.MONOSPACE
        }
        canvas.drawText("Hello WatchFace!", 20f, 250f, textPaint)
    }

Everything else is implemented bare bones as per the guides & examples.

UPDATE: The error disappeared after removing the following line from the manifest:

<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />

However, I’m still getting an all black watch face. The draw functions are being called (confirmed by writing to logcat), but nothing is being drawn.

2

Answers


  1. Chosen as BEST ANSWER

    To answer my own question:

    It was the wrong color format. Color Must include an Alpha Channel Value (for ARGB format), and also cast to an int, something like this:

    canvas.drawColor(0xFF550000.toInt())
    

  2. Since you’re starting with existing samples that work, try backtracking from where you are right now to the sample code, by incrementally removing bits of code, until you get to a point where the application works again – that might help you locate the faulty piece of code. You can go the other way around too, revert all of the code changes you made, and then slowly and incrementally re-introduce them, re-running the build each time: once the application stops working, you know that you’ve introduced a bug.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search