Hello all,
I am trying to start Live Activity from remote push notification with the new ActivityKit api.
The documentation for starting live activity from a push notification says:
When the system receives the ActivityKit push notification on a device, it starts a new Live Activity, wakes up your app, and grants it background run time to allow you to download assets that the Live Activity needs.
While the system starts the new Live Activity and wakes up your app, you receive the push token you use for updates. To update and end the Live Activity, use this update push token as if you obtained it by starting a Live Activity from within your app.
Is there any information on how to get access to the background runtime and the push token, when the app is in background when the Live Activity is started? I can get the pushToStartTokenUpdates if the app is already running and push notification arrives (and starts the Live Activity), but not in the background, which makes getting updates not possible unless user launches the app.
Thanks!
Notifications
RSS for tagLearn about the technical aspects of notification delivery on device, including notification types, priorities, and notification center management.
Post
Replies
Boosts
Views
Activity
Hello. I have a very practical problem. A company would like me to develop an iOS app for them, and my counterpart is their company's marketing team. They want me to use their Firebase account for multiple purposes, but as they are marketing team, not IT team, they do not have Apple Developer account.
So in this peculiar case, as I am the developer of the app, it seems they will need my p8 key to be placed in their Firebase account in order for Push notification to work. But I have concern as p8 key sounds like something private which I should not share with others.
Can anyone share with me what I should do in this very practical case? Is p8 key supposed to be sharable to others? I have tried to google this topic but I don't have any answers. I have even tried to ask on stackoverflow but admin over there said this question is opinion-based and closed my thread.
Hello Apple Developer Community,
I am reaching out for insights regarding an issue we're facing with Apple Push Notification Service (APNS). Despite successful implementation and functioning for other apps, we are consistently receiving a 400 TopicDisallowed error when trying to send push notifications to one specific app. Here's a detailed overview:
Issue Summary: Push notifications sent from our server to a specific app result in a 400 TopicDisallowed error from APNS. This problem is unique to this app; notifications to other apps with similar configurations are successful.
Successful Tests via Apple CloudKit Console: Notably, when using the Apple CloudKit Push Notification Console, push notifications to the problematic app are sent successfully, indicating the app's basic setup is configured correctly.
Key Details:
The topic field in the push notification request matches the app's bundle ID exactly.
The app is downloaded from the App Store, and we are using the production environment on our server.
Payload structure, APNS endpoint, and APNS Auth Key are consistent across all apps we manage.
Device tokens for the problematic app validate successfully using the tool in the push notification console.
Detailed server-side logging has not revealed significant differences between successful and unsuccessful push notification requests.
Given these factors, we are struggling to identify the root cause of this specific issue. I am wondering if anyone in the community has faced a similar problem or could offer any insights.
Any help or guidance would be immensely appreciated.
Thank you in advance!
I think I've got all the keys and entitlements set up ok. I have no problem receiving normal alerts via the UNUserNotifications framework. Now I'm trying to use PushKit (for fileProvider). I have the following in my AppDelegate
fileProvider = PKPushRegistry(queue: nil)
fileProvider.delegate = self
fileProvider.desiredPushTypes = [.fileProvider]
along with the required delegate functions. I am never provided with credentials, only an immediate call to the didInvalidatePushToken delegate.
Any suggestions appreciated.
There is no App Configuration setting in the URL below, is there a way to set it?
https://github.com/apple/device-management/blob/release/declarative/declarations/configurations/app.managed.yaml
Is something wrong with testing live activities on Dynamic Island in iOS 17?
It works fine for devices without dynamic island.
It's a timer countdown. Initially, it didn't show up on the iPhone 15 Pro, but after installing and reinstalling the app it showed up. But now, the timer freezes like it was freezing while it was being tested on a simulator.
Is there something extra I should be doing for the Dynamic Island Display?
P/S: The app uses only Live Activities without the widget.
Hello fellow developers, I am creating an application and it contains critical alerts and for that I have given the permissions but unable to find any implementations. I am using Flutter environment to develop my application and want that the application should emit a sound even if it is silent or in 'Do Not Disturb' mode.
Hi,
I’m testing out different possibilities for a client that wants to have a loyalty card service where users can register to download and install a wallet pass.
This wallet pass should be able to receive push notifications.
I have found a library that can generate apple passes but I struggle to find a good direction with the notification / update service. I’m most comfortable with using PHP but any other easy solution is also welcome.
What would be a good way to start and test things out?
Thank you!
I use the following push notification payload.
{
"aps": {
"sound": {
"name": "default",
"volume": 0
}
},
"type": "refresh"
}
When the iPhone received this, it sounds even though "volume" is set to "0".
Is this iOS bug? Or dose "default alert sound" of iOS17 override this?
I tested iOS17 and 16. This occurred both.
Is there any way to set no sound when iPhone received a specific push notification like "type": "refresh".
I am trying to start a live activity using APNs, but it is not supported with firebase or onesignal, is there any other way to send a PN to the device, I have device token, bundle ID, team ID, and apnsKeyID. I also tried hitting this URL: 'https://api.development.push.apple.com/3/device/{deviceToken}', but it gives an error "unable to set private key file" even though I have given the path to my .pem file that has a private key in it enclosed under BEGIN CERTIFICATE and END CERTIFICATE. It will be great if someone could guide me here
Greetings everyone,
we have a problem testing remote notifications to our app runing in an iOS simulator, which should be possible for quite a while now. (https://nilcoalescing.com/blog/TestingRemotePushOniOSSimulator/)
We made sure of the following prerequisites
The system requirements (recent XCode, recent MacOS, Silicone Processor) are met
The app build is set to testing
The app is in fact generating a devicetoken and sendig it to our backend
We are sending our requests to the api.sandbox.push.app.com environment
Nonetheless, we always receive a status 400, error "BadDeviceToken" response from the APNS service.
Doing the same with a physical device works like a charm, ie the message is received without any problems.
We also tried sending the same device token to a production environment, but got the same 400/BadDeviceToken error. Also the simulator-generated token does not look distorted, ie it's also just a HEX string with the same length as the working token of the physical device.
Is there anything else we need to check for this to work?
概述
应用的数据中心在海外
群名称:”CDC 大家樂集團 體驗群“
群成员A、群成员B、群成员C
问题描述:
”CDC 大家樂集團 體驗群“聊天群里的成员A给成员C发群消息,C可以收到推送消息;
成员B给C发消息,C收不到推送消息;C不是一直都收不到B的消息,而是频繁出现收不到的情况。
B给C发送消息时,服务端调用APNs服务报异常:Notification rejected by the APNs gateway。
麻烦帮查一下是什么原因导致的服务端调用APNs服务报异常。
I'm building a live activity with push token updates for my app as described in the documentation and implemented in the EmojiRangers example.
The workflow is working fine for fairly new devices (iPhone > 13) - however, the asynchronous pushTokenUpdates sequence used to observe changes to the push token of a Live Activity is not getting triggered on some older devices (i.e. iPhone XR, iPad 8th Generation).
Is there a minimum device version for this sequence?
This is the code I'm using:
"--------Task--------" gets printed,
"--------PushTokenUpdate--------" does not (on older devices):
do {
let activity = try Activity.request(
attributes: matchAttributes,
content: .init(state: initialContentState, staleDate: nil),
pushType: .token
)
Task {
print("--------Task--------")
for await pushToken in activity.pushTokenUpdates {
print("--------PushTokenUpdate--------")
}
}
} catch {
Logger().error("Error starting LiveActivity: \(String(describing: error))")
}
Steps to reproduce:
Install & Launch App
When push notifications are registered, the push notification token received is a "production" push notification token rather than a "development" push notification token.
We are trying to test on the sandbox environment with development push notification tokens, however the apn-environment for all builds we release via TestFlight are being set to "production". We wish to distribute builds via TestFlight with apn-environment set to "development".
At the moment we have only found one way to run the app with apn-environment set to "development" which is to "Export" a Debug build, then manually install it on a device via iTunes on Windows machines. This method is not efficient or considered seamless enough for non-technical testers and stakeholders. They require a seamless way to receive Debug builds via TestFlight without resorting to other third-party platforms which allow us to manually upload the "Exported Debug build".
If anyone knows how to upload a "Debug" build to Testflight which will allow the user to receive a sandbox development push token with "apn-environment" set to development I would really appreciate it.
Hey
A lot of our customers got duplicate push messages twice or more times
But we sent only once per push tokens
Additionally, devices experiencing the same happens receive similar push messages twice or more from other companies' application
This happens is especially reported on devices that have upgraded from iOS 16 to 17.
Is there something wrong with the APNS?
It
I schedule a local notification to remind me to check in at work at 8 am if I am not already checked in, the code is working fine when app is in foreground, but when I kill the app, it alway show alert no matter if I already checked in or not.
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
let isCheckedIn = AppManager.shared.isCheckedIn()
if isCheckedIn {
completionHandler([])
} else {
completionHandler([.list, .sound, .banner])
}
}
Hello,
We have an iOS application (navigation/mobility app) that we need to have it stay connected to TCP server even app is in background.
We tried disabling screen lock. We tried having location permission as "always". But it is not consistent. Usually, after 15 minutes, TCP connection is disconnected. We are unable to run code on app's side if it is in the background.
Our other workaround option is similar to WhatsApp or what every other companies / our rivals in the market do. Have a VOIP feature, use voip notification to wake up the app. But we really don't want to do that sort of thing.
Any feedback and any ideas are welcomed.
Thanks.
Hello There!,
I'm currently working on an App with an implemented timer. It was initially planned, that the User will get a notification when the timer ends. Everything works fine until the timer ends and the phone doesn't gets any notification...
This is my code:
import SwiftUI
import Combine
import UserNotifications
struct TimerView: View {
@State private var timeRemaining: TimeInterval
@State private var timerActive = false
@Binding var studyTime: Int
@Binding var selectedExam: Exam
init(studyTime: Binding<Int>, selectedExam: Binding<Exam>) {
_studyTime = studyTime
_selectedExam = selectedExam
_timeRemaining = State(initialValue: TimeInterval(studyTime.wrappedValue * 60))
}
var body: some View {
VStack {
ZStack {
Circle()
.trim(from: 0, to: CGFloat(timeRemaining / (TimeInterval(studyTime * 60))))
.stroke(Color.purple, lineWidth: 15)
.rotationEffect(.degrees(-90))
.animation(.linear(duration: 1))
.padding(40)
Text("\(timeRemaining.formattedTime)")
.font(.system(size: 50))
}
Button(action: {
self.timerActive.toggle()
}) {
Text(timerActive ? "Stop" : "Start")
.font(.title)
.padding()
}
.foregroundColor(.white)
.background(timerActive ? Color.red : Color.green)
.cornerRadius(10)
.padding()
}
.onReceive(timer) { _ in
guard self.timerActive else { return }
if self.timeRemaining > 0 {
self.timeRemaining -= 1
} else {
self.timerActive = false
sendNotification()
}
print("Time Remaining: \(self.timeRemaining)")
}
.navigationTitle($selectedExam.wrappedValue.subject)
.navigationBarBackButtonHidden(true)
.onDisappear {
// Actions if the timer View disappears
}
}
var timer: AnyPublisher<Date, Never> {
Timer.TimerPublisher(interval: 1.0, runLoop: .main, mode: .default)
.autoconnect()
.eraseToAnyPublisher()
}
func sendNotification() {
let content = UNMutableNotificationContent()
content.title = "Lernzeit vorbei"
content.body = "Deine Lernzeit für \(selectedExam.subject) ist abgelaufen!"
content.sound = UNNotificationSound.default
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)
let request = UNNotificationRequest(identifier: "timerNotification", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request) { error in
if let error = error {
print("Fehler beim Hinzufügen der Benachrichtigung zur Warteschlange: \(error.localizedDescription)")
} else {
print("Benachrichtigung zur Warteschlange hinzugefügt")
}
}
}
}
extension TimeInterval {
var formattedTime: String {
let minutes = Int(self) / 60 % 60
let seconds = Int(self) % 60
return String(format: "%02i:%02i", minutes, seconds)
}
}
I looked it up and the app is allowed to send every type of notification... (this is initialized in another part of the code)
I'm sending a push notification using Noticed Gem during the night when my phone is in airplane mode. When I wake up and disable the airplane mode, I don't get the push notification.
These are the settings:
` def ios_format(apn)
apn.custom_payload = { universal_link: url }
apn.alert = { title: title(recipient), body: message(recipient) }
apn.sound = 'default'
apn.priority = '10' # Send immediately, bypassing the
end
`
default expiration is supposed to be 30 days.
How can I debug/fix the problem? (with noticed gem)
I checked Apple consoleKIT, and I don't see discarded notifications.
Thanks
Criticism of the use of the Minimed Mobile App, problem with the update interval of the Apple Watch iOS
Subject: Error event - Minimed Mobile App . Triggered by insufficient update interval of the Watch iOS system of only 50 updates/day
Dear Sir or Madam,
I use the Minimed Mobile App in conjunction with my Medtronic 780 G insulin pump and am generally very satisfied with the app. However, I have noticed a point here that is caused by the Apple Watch iOS operating system. I would like to pass this on and ask that you please fix this problem with an update.
Updating the sensor values on watch faces on the Apple Watch
I use the Modular widget on my Apple Watch in conjunction with the Minimed mobile app to quickly and easily keep an eye on the current sensor value. Unfortunately, the sensor value in this widget is not updated automatically according to someone in the know, Apple only updates widget information 50 times a day. After a short time, a rotating arrow appears instead of the current value, which I have to press to get a sensor value displayed again in order to see the current value.
This is very inconvenient as I have to perform several actions each time to see the current value:
1.Open widget
2.Press the rotary arrow
3.Read the value
Close widget by pressing the spin button at the top right to return to the main screen
I would very much welcome it if the sensor value in Apple Watch watch faces were updated automatically, the problem is obvious - the watch faces only update 50 times a day. This would prevent me from seeing the current sensor value quickly and easily at any time without having to perform additional and cumbersome actions.
The Minimed Mobile App has been tested and approved by Medtronic through Apple. However, it must have been overlooked that this sensor value app updates the sensor value every 5 minutes, but it does not do this on the dial because, according to my friend, it only updates 50 times a day. Now it is the case that the sensor value can change every 5 minutes, but this is not shown on the watch face, which means that the Apple Watch iOS would need 288 updates for this Minimed Mobile App per day instead of only 50 updates per day.
Can you please advocate for a new update that allows an update interval of up to 288 updates per day? So that thousands of diabetics worldwide can see current values on their Apple Watch dials at any time? Without having to take several steps each time? I switched to I Phone and Apple Watch because I thought this would be possible for me. I would be very happy to hear back if this is technically possible for all diabetics worldwide who will benefit from it.
With kind regards