Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the android.app.Application extend from the core modules #2244

Merged
merged 3 commits into from
Jun 6, 2016

Conversation

atanasovg
Copy link
Contributor

@atanasovg atanasovg commented Jun 3, 2016

This pull removes the Android Application object extend from the core modules. The change enables the following scenarios:

  • Make the modules Heap snap-shottable
  • Allow users to provide custom android.app.Application implementation. This includes
    • Entirely custom application type
    • Implement an additional interface on the default com.tns.NativeScriptApplication class

The change also introduces the following paths for application initialization:

  • User provides custom application extend. In the onCreate method he should manually initialize the application module via application.android.init(this). The static-binding-generator will take care of the *.JAVA file generation.
  • No custom extend is defined. Application will use the default com.tns.NativeScriptApplication implementation provided with the Android Runtime project template. Application module is initialized upon application.start call.
  • User provides custom extend but does not initialize the application module explicitly. This falls back to a somewhat hacky implementation, that retrieves the native android.app.Aplication object through reflection. TODO: We may throw an error instead of doing this.

Note: This pull will work when we merge this one as well: NativeScript/android#471

atanasovg added 2 commits June 3, 2016 15:34
… will enable various scenarios where custom application implementation is needed.
@ns-bot ns-bot added the cla: yes label Jun 3, 2016
@atanasovg atanasovg added this to the 2.1 milestone Jun 3, 2016
@hshristov
Copy link
Contributor

👍
My only concern is how will this affect existing applications? I guess they will need to manually add this android.application.js in their project templates?

@atanasovg
Copy link
Contributor Author

@hshristov They are not forced to do so - that's the second initialization path, as listed in the pull's description. The extend will happen only if they need to add some custom initialization logic.

In other words - existing applications shouldn't be affected.

@vchimev
Copy link
Contributor

vchimev commented Jun 3, 2016

run ci

@atanasovg
Copy link
Contributor Author

run ci

@hshristov
Copy link
Contributor

👍

@atanasovg atanasovg merged commit 1ad23a3 into master Jun 6, 2016
@atanasovg atanasovg deleted the atanasovg/remove-app-activity-extends branch June 6, 2016 12:36
@lock
Copy link

lock bot commented Aug 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Aug 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants