Accessing JavaScript classes from AndroidManifest.xml


#1

Hello,

Having some issues calling a TypeScript file from the Android Manifest.
Was wondering if someone has a sample on how to call a Typescript file from the AndroidManifest.xml


#2

Do you have a sample somewhere with what you’re looking for? I’m not really following you :slight_smile:


#3

Definitely.

Inside of my AndroidManifest.xml I have the following line of code
<meta-data android:name="com.urbanairship.autopilot" android:value="com.urbanairship.AutoPilot"/>
Which should launch a built-in class that a plugin already supports. The caveat is to being a meta-data and not in a activity is that it should be executed at application level.


#4

The meta-data is simply a key-value pair of strings. If the plugin has a public class com.urbanairship.AutoPilot then you should have direct access to it from the javascript by writing com.urbanairship.AutoPilot. The TS transpiler might complain however and not recognize the class, since you won’t have class definitions for it. You can either cast away as any, write your own definitions for AutoPilot or, as a last resort, disable TS transpiler errors in tsconfig.json


#5

As a follow up, if you’ve extended a native android class in TypeScript, and that class is an activity that you would use later on in the app, you should register the Activity in your Manifest with the same name you used in the JavaProxy('a.b.c') decorator