public class

ForgeApp

extends Application
java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Application
         ↳ io.trigger.forge.android.core.ForgeApp

Class Overview

Static access to various useful parts of the application, as well as methods to control communication between Javascript and Java.

Summary

[Expand]
Inherited Constants
From class android.content.Context
From interface android.content.ComponentCallbacks2
Fields
public static JsonObject appConfig
Public Methods
static JsonObject configForModule(String name)
Get the config specified by the user at build time for a specific plugin
static JsonObject configForPlugin(String name)
static void event(String name)
Trigger an event in forge within Javascript.
static void event(String name, JsonElement params)
Trigger an event in forge within Javascript.
static JsonObject getAPIMethodInfo()
Return a JsonObject containing details about all loaded API methods.
static ForgeActivity getActivity()
Get the current activity.
static ForgeApp getApp()
static int getResourceId(String name, String type)
Get the identifier for a resource.
static void intentWithHandler(Intent intent, ForgeIntentResultHandler handler)
Invoke an intent and handle response with callback
void onCreate()
[Expand]
Inherited Methods
From class android.app.Application
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.content.ComponentCallbacks2

Fields

public static JsonObject appConfig

Public Methods

public static JsonObject configForModule (String name)

Get the config specified by the user at build time for a specific plugin

Returns
  • config dictionary as JsonObject

public static JsonObject configForPlugin (String name)

public static void event (String name)

Trigger an event in forge within Javascript. For example, menu button pressed

Parameters
name The event name i.e. 'events.menuPressed'

public static void event (String name, JsonElement params)

Trigger an event in forge within Javascript. For example, menu button pressed

Parameters
name The event name i.e. 'events.menuPressed'
params Any additional data to pass back with the event.

public static JsonObject getAPIMethodInfo ()

Return a JsonObject containing details about all loaded API methods. Used for inspecting modules.

public static ForgeActivity getActivity ()

Get the current activity. Useful for many Android methods which require a context.

Returns
  • Current activity.

public static ForgeApp getApp ()

public static int getResourceId (String name, String type)

Get the identifier for a resource. R.string.name won't work when plugins are included in Forge

Parameters
name Name of resource
type Type of resource, i.e. "string"
Returns
  • Resource id

public static void intentWithHandler (Intent intent, ForgeIntentResultHandler handler)

Invoke an intent and handle response with callback

Parameters
intent Intent to be invoked
handler Callback for Intent results

public void onCreate ()