-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Activity created but not show up #93
Comments
Could you share your Swift code? I encountered the same issues before, but I managed to fix them. I think we're running into the same problem. |
When implementing the Live Activity widget:
If your widget isn't displaying, please check if you've properly implemented the |
Yeah i use same struct with example but didn't work. Then i use this package https://pub.dev/packages/flutter_live_activities and without app group and custom struct i was able to create and update activities after i uncheck "copy only when installing" under the embed frameworks in build phases. |
Heyy @ibrahimKonyali @DKMonster I am also having the same issue, my flutter engine is updating and creating the activity, but the live activity, notification and dynamic island are not showing, in both my simulator and mobile. But when the app is in background and when I click on Dynamic Island it's opening the app. //
// extension_example.swift
// extension-example
//
// Created by Dimitri Dessus on 28/09/2022.
//
import ActivityKit
import WidgetKit
import SwiftUI
@main
struct Widgets: WidgetBundle {
var body: some Widget {
if #available(iOS 16.1, *) {
RideTrackingApp()
}
}
}
struct LiveActivitiesAppAttributes: ActivityAttributes, Identifiable {
public typealias RideData = ContentState
public struct ContentState: Codable, Hashable {
var rideStatus: String
var elapsedTime: String
var distanceCovered: String
}
var id = UUID()
}
let sharedDefault = UserDefaults(suiteName: "group.goeleventhmile.liveactivities")!
@available(iOSApplicationExtension 16.1, *)
struct RideTrackingApp: Widget {
var body: some WidgetConfiguration {
ActivityConfiguration(for: LiveActivitiesAppAttributes.self) { context in
// let pizzaName = sharedDefault.string(forKey: context.attributes.prefixedKey("rideStatus"))! // put the same key as your Dart map
// let pizzaPrice = sharedDefault.string(forKey: context.attributes.prefixedKey("elapsedTime"))
// let quantity = sharedDefault.string(forKey: context.attributes.prefixedKey("distanceCovered"))
VStack(alignment: .leading) {
Text(context.state.rideStatus)
.font(.headline)
.padding(.bottom, 4)
HStack {
Text("Time:")
.font(.caption)
Text(context.state.elapsedTime)
.font(.body)
.foregroundColor(.blue)
}
HStack {
Text("Distance:")
.font(.caption)
Text(context.state.distanceCovered)
.font(.body)
.foregroundColor(.green)
}
}
.activityBackgroundTint(Color.gray.opacity(0.2))
.activitySystemActionForegroundColor(Color.blue)
} dynamicIsland: { context in
DynamicIsland {
DynamicIslandExpandedRegion(.leading) {
VStack {
Text("Status")
Text(context.state.rideStatus)
.font(.headline)
.foregroundColor(.primary)
}
}
DynamicIslandExpandedRegion(.trailing) {
VStack {
Text("Time")
Text(context.state.elapsedTime)
.font(.headline)
.foregroundColor(.primary)
}
}
DynamicIslandExpandedRegion(.bottom) {
VStack {
Text("Distance")
Text(context.state.distanceCovered)
.font(.headline)
.foregroundColor(.primary)
}
}
} compactLeading: {
Text("T")
} compactTrailing: {
Text("D")
} minimal: {
Text("R")
}
.widgetURL(URL(string: "http://www.apple.com"))
.keylineTint(Color.blue)
}
}
}
extension LiveActivitiesAppAttributes {
func prefixedKey(_ key: String) -> String {
return "\(id)_\(key)"
}
} I have tried running the app through xcode, and this is the error I am getting
|
Hello everyone, I'm trying to integrate Dynamic Island functionality into my Flutter app using the package live_activities, and I've followed the documentation thoroughly. However, I'm running into some issues. Specifically, Dynamic Island does not appear on the screen. I tested a real device that supports this function. @ibrahimKonyali @manoj1749, have you found a solution? I would appreciate any advice or guidance. I appreciate any help you can give me. |
What error is it showing for you? |
@manoj1749 <But when the app is in background and when I click on Dynamic Island it's opening the app.> |
You can see the dynamic island minimising and maximising when holded and all?. If that so, can you check whether the data which you are trying to send form flutter is being sent to native side or not? Also share youe AppDelegate.swift of the widget. |
check your live activities widget iOS version target. make sure its 16.1 or lower than your emulator iOS version. took me one week to figure this out |
In my case live activities did not show up after upgrading to |
Hello all,
I'm following the procedure and can't get the activity show up on lock screen.
Here what i did so far;
Opened; ios/Runner.xcworkspace
Added widget extension with embed application runner is selected.
Activated the widget extension from dialog
Added push notification to runner
Enabled NSSupportsLiveActivities for both widget extension info and runner info
Added App group capability for both widget extension and runner and gave same id for both
I used example code for native side and gave same app group id to UserDefaults
https://github.com/istornz/flutter_live_activities/blob/main/example/ios/extension-example/extension_example.swift
let sharedDefault = UserDefaults(suiteName: "YOUR_GROUP_ID")!
And on flutter side, i init() the plugin and call createActivity()
After doing all of these and tried to create activity, this is only error i get from runner (it creates activity and return activity id without problem)
[User Defaults] Couldn't read values in CFPrefsPlistSource<0x28010f900> (Domain: group.xxx.xxx, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
Even id in app group for both in extension and runner is same and that id is active on Certificates, Identifiers & Profiles at developer at apple it still doesn't show the activity on lock screen.
If you are going to suggest using app group id with TeamID in it, i already tried that and didn't work either.
The text was updated successfully, but these errors were encountered: