Skip to content

Numeric APPLICATION_ID manifest value silently ignored #65

@bddckr

Description

@bddckr

Summary

When following the official setup docs, the recommended developer mode manifest entry:

<meta-data
    android:name="com.meta.wearable.mwdat.APPLICATION_ID"
    android:value="0" />

is silently ignored by the SDK. Android's manifest parser infers "0" as an Integer, and Bundle.getString() returns null when it encounters a non-String type:

Bundle  W  Key com.meta.wearable.mwdat.APPLICATION_ID expected String but value was a java.lang.Integer.  The default value <null> was returned.
Bundle  W  Attempt to cast generated internal exception:
           java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
               at android.os.BaseBundle.getString(BaseBundle.java:1416)
               at com.meta.wearable.dat.core.internal.configuration.DatConfiguration$Companion.getStringFromManifest(...)

This is a well-known Android behavior with <meta-data> values that look numeric. The same issue will affect production apps whose Application IDs from the Wearables Developer Center happen to be purely numeric.

Workaround

Prefix the value with \ to force string type:

<meta-data
    android:name="com.meta.wearable.mwdat.APPLICATION_ID"
    android:value="\0" />

Suggested fix

The SDK should read the value using Bundle.get() and call .toString(), rather than Bundle.getString(). The docs should also be updated to use \0 instead of 0.

Affected version

com.meta.wearable:mwdat-core:0.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions