Skip to content

Commit 1915b69

Browse files
Ulrico972rlepinski
authored andcommitted
update the headless task time out and make sure it ends (#694)
1 parent f7c9dc4 commit 1915b69

File tree

6 files changed

+34
-21
lines changed

6 files changed

+34
-21
lines changed

android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ Airship_minSdkVersion=23
33
Airship_targetSdkVersion=35
44
Airship_compileSdkVersion=35
55
Airship_ndkversion=26.1.10909125
6-
Airship_airshipProxyVersion=14.9.0
6+
Airship_airshipProxyVersion=14.10.0

android/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
<service
1111
android:name="com.urbanairship.reactnative.AirshipHeadlessEventService"
12-
android:exported="false" />
12+
android:exported="false"
13+
android:stopWithTask="true" />
1314

1415
<activity
1516
android:name="com.urbanairship.android.framework.proxy.CustomMessageCenterActivity"

android/src/main/java/com/urbanairship/reactnative/AirshipHeadlessEventService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class AirshipHeadlessEventService : HeadlessJsTaskService() {
2626
}
2727

2828
companion object {
29-
private const val TASK_TIMEOUT: Long = 60000
29+
private const val TASK_TIMEOUT: Long = 1000
3030
private const val TASK_KEY = "AirshipAndroidBackgroundEventTask"
3131

3232
fun startService(context: Context): Boolean {

example/index.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
import { AppRegistry } from 'react-native';
22
import App from './src/App';
33
import { name as appName } from './app.json';
4+
import Airship, { EventType } from '@ua/react-native-airship';
5+
6+
Airship.addListener(EventType.PushReceived, (event) => {
7+
// Handle push received
8+
console.log("PushReceived");
9+
Airship.channel.editAttributes()
10+
.setAttribute("ulrich_first_param", "Ulrich RN 25")
11+
.apply();
12+
Airship.channel.editTags()
13+
.addTags(["Ulrich RN Receive 25"])
14+
.apply()
15+
});
16+
17+
// Set up event listeners
18+
Airship.addListener(EventType.NotificationResponse, (event) => {
19+
// Handle notification responses
20+
});
21+
22+
Airship.addListener(EventType.PushReceived, (event) => {
23+
// Handle push received
24+
});
25+
26+
Airship.addListener(EventType.ChannelCreated, (event) => {
27+
// Handle channel creation
28+
});
29+
30+
Airship.addListener(EventType.PushNotificationStatusChangedStatus, (event) => {
31+
// Handle push notification status changes
32+
});
433

534
AppRegistry.registerComponent(appName, () => App);

example/src/App.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,6 @@ export default function App() {
3131
}
3232
});
3333

34-
// Set up event listeners
35-
Airship.addListener(EventType.NotificationResponse, (event) => {
36-
// Handle notification responses
37-
});
38-
39-
Airship.addListener(EventType.PushReceived, (event) => {
40-
// Handle push received
41-
});
42-
43-
Airship.addListener(EventType.ChannelCreated, (event) => {
44-
// Handle channel creation
45-
});
46-
47-
Airship.addListener(EventType.PushNotificationStatusChangedStatus, (event) => {
48-
// Handle push notification status changes
49-
});
50-
5134
setIsAirshipReady(true);
5235
} catch (error) {
5336
setAirshipError(error instanceof Error ? error.message : String(error));

react-native-airship.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ Pod::Spec.new do |s|
4040
end
4141
end
4242

43-
s.dependency "AirshipFrameworkProxy", "14.9.0"
43+
s.dependency "AirshipFrameworkProxy", "14.10.0"
4444
end

0 commit comments

Comments
 (0)