Skip to content

Commit e896fbc

Browse files
Added unique Android ‘package’ and iOS ‘CFBundleIdentifier’. Changed nativescript.id in package.json.
1 parent bf78606 commit e896fbc

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

app/App_Resources/Android/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="__PACKAGE__"
3+
package="com.company.android"
44
android:versionCode="1"
55
android:versionName="1.0">
66

app/App_Resources/Android/app.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
android {
99
defaultConfig {
1010
generatedDensities = []
11-
applicationId = "org.nativescript.packagetest"
11+
applicationId = "com.company.android"
1212

1313
//override supported platforms
1414
// ndk {

app/App_Resources/iOS/Info.plist

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<string>${PRODUCT_NAME}</string>
99
<key>CFBundleExecutable</key>
1010
<string>${EXECUTABLE_NAME}</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>com.company.ios</string>
1113
<key>CFBundleInfoDictionaryVersion</key>
1214
<string>6.0</string>
1315
<key>CFBundleName</key>

app/app.component.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
<StackLayout class="p-20">
2-
<Label text="Tap the button" class="h1 text-center"></Label>
3-
<Button text="TAP" (tap)="onTap()" class="btn btn-primary btn-active"></Button>
4-
<Label [text]="message" class="h2 text-center" textWrap="true"></Label>
2+
<Label [text]="packageId" class="h2 text-center"></Label>
53
</StackLayout>

app/app.component.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import { Component } from "@angular/core";
1+
import { Component, OnInit } from "@angular/core";
2+
import * as application from "application";
3+
4+
declare var NSBundle: any;
25

36
@Component({
47
selector: "my-app",
58
templateUrl: "app.component.html",
69
})
7-
export class AppComponent {
8-
public counter: number = 16;
10+
export class AppComponent implements OnInit {
11+
12+
packageId: string = "loading...";
913

10-
public get message(): string {
11-
if (this.counter > 0) {
12-
return this.counter + " taps left";
13-
} else {
14-
return "Hoorraaay! \nYou are ready to start building!";
14+
ngOnInit() {
15+
if (application.ios) {
16+
this.packageId = NSBundle.mainBundle.bundleIdentifier;
17+
} else if (application.android) {
18+
this.packageId = application.android.context.getPackageName();
1519
}
1620
}
17-
18-
public onTap() {
19-
this.counter--;
20-
}
2121
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"readme": "NativeScript Application",
55
"repository": "<fill-your-repository-here>",
66
"nativescript": {
7-
"id": "org.nativescript.packagetest",
7+
"id": "com.company.nativescript",
88
"tns-ios": {
99
"version": "2.4.0"
1010
},

0 commit comments

Comments
 (0)