Native Extension Tip // Finding an Android Resource ID

Often when writing native extensions we've been faced with the problem of retrieving resources from the library. The official way to do this is to use the FREContext instance and the getResourceById() function. However there are several times when you'll want to access a resource packaged in your extension when the application has not been initialised (for example, onReceive events with a BroadcastReceiver), which initially seems impossible as you won't have access to your FREContext as yet.

There is however a simple workaround using the code below. You'll still need to be able to determine the package name of your application, which you can generally get from the Android Context.getPackageName().
Continue reading Native Extension Tip // Finding an Android Resource ID