3

I'm trying to create and ANE that will handle the autoupdate, (because we're not going to put the application on the android market) This is how it works :

autoUpdate = new AutoUpdateApk(getApplicationContext());

But how am I able to get the context from the FREContext I would really appreciate any help, thank you in advance

Khalil Bhm
  • 394
  • 3
  • 13

1 Answers1

4

Very simply you can use your main activity for references to the application context, for example in a FREFunction implementation:

public FREObject call(FREContext context, FREObject[] args)
{
    Context androidContext = context.getActivity();
}
Michael
  • 3,776
  • 1
  • 16
  • 27
  • Thank you very much, I just want to ask one more question, now I want the application to start on Android Startup, I have found all the answers needed about it, but not on flex, So I am having a terrible issue passing the parameters between the manifest ( on adobe flash builder, the main application) and the native code. Do you have any idea how to solve this ? – Khalil Bhm Sep 04 '13 at 17:26
  • I added an answer to your other question, let me know if you're still having problems. Cheers. – Michael Sep 08 '13 at 22:56
  • Does that mean that if I have an **Application** class declared in my AndroidManifest.xml, I can invoke it's lifecycle methods? – IgorGanapolsky May 17 '16 at 16:45
  • Potentially, but the lifecycle methods are best left to the Android system unless you are doing something unusual. – Michael May 18 '16 at 03:15
  • @Michael Actually, FREFunction and FREContext completely forego AndroidManifest.xml. Nothing I register in my Manifest gets picked up by the system. – IgorGanapolsky May 19 '16 at 18:06
  • If you are talking about the AndroidManifest.xml in your java lib then yes that never gets used. You need to register manifest items in the manifest additions node of your AIR application descriptor. – Michael May 20 '16 at 01:02