Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit ef89f65

Browse files
committed
test(JavaScriptApp): extend android application
1 parent 06a163e commit ef89f65

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

Diff for: demo/JavaScriptApp/app/App_Resources/Android/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<uses-permission android:name="android.permission.INTERNET"/>
2020

2121
<application
22-
android:name="com.tns.NativeScriptApplication"
22+
android:name="org.myApp.Application"
2323
android:allowBackup="true"
2424
android:icon="@drawable/icon"
2525
android:label="@string/app_name"

Diff for: demo/JavaScriptApp/app/application.android.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var superProto = android.app.Application.prototype;
2+
// the first parameter of the `extend` call defines the package and the name for the native *.JAVA file generated.
3+
var Application = android.app.Application.extend("org.myApp.Application", {
4+
onCreate: function() {
5+
superProto.onCreate.call(this);
6+
7+
// At this point modules have already been initialized
8+
9+
// Enter custom initialization code here
10+
},
11+
attachBaseContext: function(base) {
12+
superProto.attachBaseContext.call(this, base);
13+
// This code enables MultiDex support for the application (if needed)
14+
// android.support.multidex.MultiDex.install(this);
15+
}
16+
});

Diff for: demo/JavaScriptApp/webpack.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ module.exports = env => {
6060
target: nativescriptTarget,
6161
entry: {
6262
bundle: entryPath,
63+
application: "./application.android",
6364
},
6465
output: {
6566
pathinfo: false,

0 commit comments

Comments
 (0)