Skip to content
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

iOS Background Reading #62

Open
thomasklaush opened this issue Jan 18, 2022 · 10 comments
Open

iOS Background Reading #62

thomasklaush opened this issue Jan 18, 2022 · 10 comments

Comments

@thomasklaush
Copy link

Is it possible to do iOS Background reading?

Meaning reading a tag without the annoying pop-up of the iPhone.

@mekjolle
Copy link

I was about to ask this question myself.

Would be a really nice feature and should be possible with the CORENFC library having added this feature lately.
Please refer to the following link -> Adding Support for Background Tag Reading

@timnew
Copy link
Contributor

timnew commented Jan 20, 2022

Based on the code

func application(_ application: UIApplication,
                 continue userActivity: NSUserActivity,
                 restorationHandler: @escaping ([Any]?) -> Void) -> Bool {

    guard userActivity.activityType == NSUserActivityTypeBrowsingWeb else {
        return false
    }

    // Confirm that the NSUserActivity object contains a valid NDEF message.
    let ndefMessage = userActivity.ndefMessagePayload
    guard ndefMessage.records.count > 0,
        ndefMessage.records[0].typeNameFormat != .empty else {
            return false
    }

    // Send the message to `MessagesTableViewController` for processing.
    guard let navigationController = window?.rootViewController as? UINavigationController else {
        return false
    }

    navigationController.popToRootViewController(animated: true)
    let messageTableViewController = navigationController.topViewController as? MessagesTableViewController
    messageTableViewController?.addMessage(fromUserActivity: ndefMessage)

    return true
}

I think it can't be fully handled by a FlutterPlugin. Instead you might need to go to the Runner app to read the tag info and do the deep linking yourself as any other universal/deeplinking related scenarios

@Harry-Chen
Copy link
Contributor

It's something similar to Android's foreground dispatching (#17). In these modes, you do not have to actively call some API to poll a tag. The OS will call your handler instead.

However as a Flutter plugin, it is difficult to act as a handler. You have to add some rather complex native code to your project. So we might not be able to support this easily.

@spehj
Copy link

spehj commented Sep 4, 2023

I was wondering if anyone has successfully implemented iOS background reading in Flutter. Doing this requires some native code, and it's challenging for me to find any useful resources.

Has anyone progressed on this issue? If so, could you possibly share some directions or even link to a GitHub repository with a Flutter example?

Your insights would be incredibly helpful for those of us looking to implement this feature.

Thank you!

@plut9
Copy link

plut9 commented Sep 5, 2023

I was wondering if anyone has successfully implemented iOS background reading in Flutter. Doing this requires some native code, and it's challenging for me to find any useful resources.

Has anyone progressed on this issue? If so, could you possibly share some directions or even link to a GitHub repository with a Flutter example?

Your insights would be incredibly helpful for those of us looking to implement this feature.

Thank you!

I'd be interested in this as well as we're trying to achieve background NFC scanning on iOS for a customer-specific feature.

@Harry-Chen Harry-Chen pinned this issue Sep 6, 2023
@zigapovhe
Copy link

Need this too! I'm very surprised this doesn't exist yet.

@HenriqueMatias
Copy link

Hi everyone. Any development on this item?

@spehj
Copy link

spehj commented Apr 2, 2024

Hi everyone. Any development on this item?

I had to implement it on my own. I wrote some iOS native code and used method channels.

@HenriqueMatias
Copy link

HenriqueMatias commented Apr 7, 2024

Hey @spehj thank you for the hint.
So did you fork the project or you wrote the code from scratch?

@spehj
Copy link

spehj commented Apr 7, 2024

@HenriqueMatias I wrote it from scratch in AppDelegate.swift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants