I'm trying to find out if it is possible to modify the notification of another app (the calendar app from Samsung) from my own app. Specifically I'd like to change the alarm for a calendar event from a one-time sound (which is silent, if the phone is set to vibrate) to a repeating vibrate.
Can I even modify the notifications belonging to a differnt app?
If I can't, could my app get notified about all notifications and just rethrow my own, modified notifications?
You probably won't be able to change the notifications of that app because you'd have to modify the app's code directly, where the notification is being fired.
To your second question: If the calendar app communicates over intents, you could create an app which registers on the desired intent (through an Intent filter). When the appropriate intent is fired by the calendar app, you would see a dialog which lets you choose between the applications which can accept it, where also yours should appear. At the same dialog you could then set your app as the default and then handle the notification of the data properly.
Hypothetically, because in the end it depends on how the mentioned Samsung calendar app has been implemented.
Related
I'm trying to make an app where my user would be able set multiple countdown timers and be alerted when they are finished.
It needs to keep running and be precise even if the app is closed.
It needs to ring (default alarm sound) and vibrate. Only vibrate if sound is off. But do both if the device is on Do Not Disturb mode (after all he set the alarms himself).
It needs to show a the alarm name and have a button to dismiss/turn it off even if screen is off or if he is using other apps.
Previously I was using a BroadcastReceiver to open an activity that would do all that, but it doesn't seem to be working with flutter using a channel and native code on Android.
And according to this I should use high priority notifications instead.
And I'm also kinda new to Flutter, so I've been trying with channels, pendingintents, broadcastreceivers and a second native activity to show the alarm message with a dismiss button. It's not working. It shows the native activity only if the flutter app is on foreground.
I see there are a few plugins like intents, Alarm_manager and local notifications for flutter that should do it but I can't find a way to fulfill all my needs with them.
So I'm asking the pros: what's the best way to achieve this?
For Android, you can use android_alarm_manager_plus package. On iOS however, there's no equivalent feature of Android's AlarmManager as it recommends to create a calendar event or reminder for an alarm. As a workaround, you can use flutter_local_notifications for scheduled notifications.
I would like to cause an alarm on a remote iphone/android device when the app is running or not running.
How do I achieve it ?
I can only think of Whatsapp/Skype when there is incoming call, its ringing.
Or would it be possible to cause the phone to play a looping alarm sound on Push Notification.
Another very clear example is "Find My iPhone" app which can trigger a loud alarm to an iPhone.
How can I achieve this programmatically on ios and android ?
Its possible using FireBase Notification Services with JobService & FirebaseMessagingService.
Download the FireBase samples from here .Run module "messaging".I tested it and I was able to receive the notification , even in the Application killed state.
To manage events periodically/scheduled you must implement & deploy your Server somewhere.You can also check FireBase Functions (Beta) to easily implement Server.
To show something (Alaram/UI like calling screen) to user start your custom Activity while receiving FireBase notification.Override handleIntent from FirebaseMessagingService.So that you can receive data from your killed/idle Application.
FireBase Service is System Service & it will be always running.Please have a read.
Code snippet
#Override
public void handleIntent(Intent intent) {
super.handleIntent(intent);
// Get Data here
Log.d(TAG, "intent.."+intent.getExtras());
Intent intent1=new Intent(this,MainActivity.class);
intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent1);
}
Note : Some devices (Eg; ASUS's Mobile Manager) may reject to start Application's receiver while , Notification arrives.In that case please provide appropriate permissions.
1 possible solution could be schedule alarm event with repeatInterval on receiving push notification.
EDIT
We can create custom notifications using Notification extensions.They are called as soon as notification arrives & we can present customized view with image/video downloading. So you can try there to schedule events.
For iOS, you will need a server to deliver a push notification to your app, where the notification references a custom audio alert to be played. The audio alert has to be included within the app's bundle as stated in Apple docs.
This alert can't be longer than 30 seconds. If you want the alert to be played longer, you can send send another push notification times roughly 30-seconds after and stop sending the alert when a) user open the app or b) you've reached the maximum threshold.
It's generally not good practise to send multiple notification containing the same payload, unless there is a good reason.
I would suggest splitting up this question into two: one for iOS, and another for Android.
How does an Android alarm app or any other time based notifications app like Calendar, Clock, etc work? More specifically, how does it show up the notifications at exactly the time specified by the user? Does it constantly run in the background and as soon as the required time comes up, does it show the notification? Or does it schedule the notification in Android's kernel before exiting? I am working on an app that needs to give the user notifications at times specifies by him. I am not able to figure out how to do that.
Maybe what you mean is to create an alarm, you can see this example.
I am developing an app in Android targeting versions >= 4.0
(I am able to use the Calendar API)
In my app I receive array of events from a server and I cache them locally using SQLite.
I had a requirement for this events to also appear in the native phone calendar.
I managed to have my app insert events in the native phone calendar using the Calendar API.
Now, I have another requirement to be able to start my app (event details screen) when an event created using my app is clicked from the native phone calendar.
My question is, am I able to achieve this in Android and if so, then how? Is there something like a pending intent I can specify when inserting events in the calendar from my app ?
I think you can use AlarmManager to do that, I used did diffrently but it can be used also for this task. just register an alarm to the time you want yourprogram to be activated and when the BroadcastReciver class get the onRecieve start your application.
maybe there are other simpler ways to do that. but I dont know them.
you can see: Alarm Manager Example
for more details regarding AlarmManager
I have an app which is on Android and iOS. I have added a local notification to fire every 24 hours at a time specified by the user of the app. In Android, the local notification functionality is exactly what I need, but in iOS it seems to lack the functionality I need, unless maybe I am missing something...
Lets say the user sets the time the notification is to fire to 11:00am. In Android, at 11AM, it will wake up the app, go to the broadcase receiver and I am able to run code in a method that calls out to an API to fetch the latest data. Once it gets the data, it posts the notification to the user.
In iOS, it seems the data being posted to the user has to be pre-scheduled. So I have to create the notification message during scheduling of the notification. What I need is to be able to do something more like the above example.
So the problem is that at the time of when the notification is scheduled to fire, I need to check for fresh data, not the day before...
Any suggestions?
The same functionality doesn't exactly exist on iOS.
You can setup a local notifications using the functionality of a UILocalNotification object. With this you can set fireDate, etc. which is sort of like a push notification without a server. You can send a message, add a badge on the app icon, play a sound, etc.
Now the issue is that the app doesn't get launched by the OS. The app simply registers a notification in the OS, which is then handled at the fireDate time. This means you won't be able to have a chance to check for data and verify whether to continue with the notification, etc.
UILocalNotification Class Reference