cordovavisual-studio-2015cordova-pluginstacoace-plugin

start android activity through Cordova Ace Plugin


Is it possible to add an existing android project to Cordova Ace project, and start the native activity? If yes, how do we achieve it?

I've got an Eclipse android project here (with complete Sample Project code) and put the whole project code in the "native" folder of Cordova Ace project. But I got lots of compiled issue.

I've tried several days but can't achieve that.

Environment: VS 2015 Enterprise, TACO

Much appreciated for your help.


Solution

  • It is possible. I just added an API to make this easier from JavaScript:

    ace.android.startActivity("package.MyActivity", 
        function(s) { /* success */ },
        function(e) { /* error */ });
    

    Note that this is for starting additional activities. The initial activity must derive from CordovaActivity, so if you want to customize that, you'll need to modify the generated MainActivity.java file.

    Also, don't forget to include your activity in your AndroidManifest.xml. You can copy the generated one from platforms/android into native/android and make modifications there. That way, your copy will overwrite the default one during the build process.

    Even without this API, your own Java code that you invoke via other means can always start an activity the way that it always has. I hope that helps! I'll update the documentation.