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

Commit 4b17ac4

Browse files
committed
fix: project build on android, ios background notifications
1 parent 3f7b815 commit 4b17ac4

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

demo/app/App_Resources/Android/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
android:xlargeScreens="true"/>
1212

1313
<uses-sdk
14-
android:minSdkVersion="17"
14+
android:minSdkVersion="19"
1515
android:targetSdkVersion="__APILEVEL__"/>
1616

1717
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"nativescript-dev-typescript": "~0.6.0",
3030
"nativescript-dev-webpack": "~0.14.0",
3131
"tslint": "^5.8.0",
32-
"typescript": "~2.7.2"
32+
"typescript": "~2.8.1"
3333
},
3434
"scripts": {
3535
"build.plugin": "cd ../src && npm run build",

native-src/ios/PushPlugin/PushManager.m

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,18 @@ - (void)my_application:(UIApplication *)application didReceiveRemoteNotification
143143
}
144144
NSLog(@"didReceiveNotification");
145145

146-
UIApplicationState appState = UIApplicationStateActive;
147-
if ([application respondsToSelector:@selector(applicationState)]) {
148-
appState = application.applicationState;
149-
}
150-
151-
if (appState == UIApplicationStateActive) {
152-
[Push sharedInstance].notificationMessage = userInfo;
153-
[Push sharedInstance].isInline = YES;
154-
[[Push sharedInstance] notificationReceived];
155-
} else {
156-
[Push sharedInstance].launchNotification = userInfo;
157-
}
146+
UIApplicationState appState = UIApplicationStateActive;
147+
if ([application respondsToSelector:@selector(applicationState)]) {
148+
appState = application.applicationState;
149+
}
150+
151+
if (appState == UIApplicationStateActive || appState == UIApplicationStateBackground) {
152+
[Push sharedInstance].notificationMessage = userInfo;
153+
[Push sharedInstance].isInline = appState == UIApplicationStateActive ;
154+
[[Push sharedInstance] notificationReceived];
155+
} else {
156+
[Push sharedInstance].launchNotification = userInfo;
157+
}
158158
}
159159

160160
- (void)my_application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {

0 commit comments

Comments
 (0)