How can I create an Alarm Clock on iOS with Flutter - ios

It seems so much easier to create an alarm clock that sends an notification on Android, but so much harder on iOS. Anyone got any ideas on how to do that on iOS? Which packages should i use , etc...

To create an alarm clock on iOS using Flutter, you will need to use the flutter_local_notifications plugin. This plugin allows you to schedule and display notifications within your Flutter app. Here are the basic steps to create an alarm clock:
Install the flutter_local_notifications plugin by adding it to your pubspec.yaml file and running "flutter packages get"
Import the plugin in your Dart code and initialize it
Use the plugin's schedule method to schedule a notification for the desired alarm time
Handle the notification when it is displayed, such as by playing an alarm sound
You can find more detailed instructions and sample code in the flutter_local_notifications documentation and examples.

Related

Does Flutter Background Fetch work on iOS when the app is terminated?

I'm building a Flutter app and need to call a function every day (to schedule some notifications). I came across the flutter_background_fetch package, which seems to be a perfect solution for Android, since the main limitation of the minimum 15 minute interval is not a problem.
However, I am supremely confused about how well the package works for iOS. According to the README, "When your app is terminated, iOS no longer fires events". However, I've also seen posts on Stackoverflow that claim that iOS Background App Refresh periodically relaunches your app to run background fetches (and posts that say it is unreliable or doesn't work at all).
So does flutter_background_fetch work on iOS when the app is terminated (eg. double tap home and swipe up)?
Edit: Also exploring flutter_workmanager, which seems promising.
There is no perfect Dart solution for iOS to schedule background task as android when app terminate, in android we can use Alarm Manager
But you can try native side implementation with BGTaskScheduler
https://github.com/fluttercommunity/flutter_workmanager

flutter - FCM: custom vibration on iOS

I wrote an app that should notify people if something happend. Because of that it is important, that the people hear the notification. i have chosen flutter to develop parallel for android and ios. For android I have now got everything done.
For iOS I have been able to get my own sound on notifications.
But I don't found a solution how I can set my own vibration.
Do either of you know how I can set a vibration other than the short twitch?
I used the tutorial from firebase_messaging on flutter.io and set the sound during the notification rest call on the server.
If you want to see the source code, I can add it.
I thank you in advance for your support.
Kai

Open Android Alarm With Flutter

I have a quick question about alarm service android in flutter.
now I'm making a function to open the android alarm from flutter.
I have tried the "android alarm manager" plugin to solve my problem. but after trying to implement it, it turned out that it wasn't the plugin that I needed.
All I need to do is open the alarm from flutter, that's all.
It looks like this:
The condition when clicking the "set Alarm" button will immediately open the alarm application.
Thank you for the opportunity, I am very open with all opinions and answers.
Best Regards.
This might work https://pub.dartlang.org/packages/alarmclock
I have not tried it. But should work

What's solution to make task background in iOS same service in Android?

I'm newbie iOS. I have been develop Phonegap for Android and iOS. My App is update data from server every 1hour. In Android, i use service to do that. My app in Android working very good. Now, i want to develop version for iOS, and i have problem when update data from server every 1hour. I was research but not find anyway for my app.I don't know what's solution to replace for service in Android. Can you help me, what's solution. This have been kill me. Thank you so much.
Short answer is NO as Apple has restriction on background task running especially cases like yours.
But if you are downloading small amount of content, you do have some other options. From IOS 4.0 or above, you can declare your app to run in background when you fall under the following categories:
Audio
Location updates
Voice over IP
Newsstand downloads
External accessory communication
Bluetooth networking
Bluetooth data sharing
Background fetch (IOS 7)
Remote notifications (IOS 7)
In order to do so, you need to flag your app in the info.plist for Required Background Modes option. Apple will review your app specific in this area once you declared the option.
For your case to download the data, the possible option is to use the new feature in IOS 7 that's the background fetch or remote notification above. The suggestion from DOM was not asking you to download the content through push notification. But instead to use push notification to wake up your application and start downloading new content.
If you don't want to use push notification, the only way to go is register for background fetch. However, no matter which option you want to use, each download will only last for 30 seconds. And after that, your app will put into suspension mode again.
you can have a look on the link here:
Declaring Your App’s Supported Background Tasks
I think your best bet would be to use the push services instead of having your app go get data. Making your app do it is unreliable with phonegap apps because you cant create a service interface and you can not guarantee that your app will be running. With push service though, if your app isn't running, it will be woken up in a manner of speaking.
Take a look at this great how-to article that also discusses what push provides you.

Create Geolocation plugin for phonegap iOS to run in background

since watchposition doesn't run for more than 30 min in background, i have to create a geolocation plugin in order to register position every 5 minute on my webserver.
Ther problem is that i don't know quite nothing about objective-c. So anyone can help me or give me some parts of code with i can do something? thanks in advance
You don’t need to create a plugin for your phonegap app to receive location updates in the background. I’ve produced an iOS version of my phonegap-based navigator app and successfully got it receiving position updates while running in the background. I’ve tested it extensively in the “real-world” and it works reliably without any limit on the duration for receiving location updates.
Firstly, you need to be using XCode to develop your phonegap app - I’m not sure you can set the correct properties in your iOS app if you’re using Phonegap Build. You can set the “UIBackgroundModes” key with a value of “location”, which will cause iOS to trigger the JS callback function you have registered with watchPosition() each time a location update is received.
See this page for details about iOS project keys.
See this page for how to set the background modes key in XCode. The value you want to select is “App registers for location updates”.
Hope this helps!

Resources