How to show status bar icon for the Alarm set - android

I am developing a little Alarm clock application for my own purposes.
What I want to know is how to tell the system that an alarm is set in order to show the alarm icon on the RIGHT side of the status bar (where battery, signal etc. are).
I found a way to put the time of my next alarm by writing it to system settings, though it might not be a good way. But I can't figure out how to get this icon.
There are posts on this saying it's impossible, but there actually are apps on the PlayStore that do it.
Thanks in advance!

Related

How to handle a click on the clock in the settings pane in Oreo+?

I'm trying to handle a click event on the clock on the Settings Pane. I'm sort of confused on the terminology which isn't helping, but here's a screenshot:
I've got an app that I'm developing (If you're curious it's here: https://play.google.com/store/apps/details?id=com.fric.beethovenalarmclock&hl=en)
Anyhow, I'm really not sure what the button does. The default behavior seems to create a new alarm using the stock Google alarm clock. When I set an alarm on my app, though, it launches the intent for the wake screen. I'd like to be able to choose which activity in my app to launch, depending on whether sound is playing, or an alarm is set.
I couldn't find any documentation anywhere on what this button is or how to handle a click on it.
Thanks in advance!

How to set up reliable alarms while developing an application for Android Marshmallow or upper?

In the last year I have bought 4 different Android phones and all of them had got failures with the calendar notifications. Sometimes the notification for an event was shown and sometimes wasn't shown at all. I investigated a lot and found a problem in the "Calendar Storage" app, a Content Provider that is in the application framework layer. Notifications stop to be always shown as of the version 6.0.1. That's the reason why I want to develop my own calendar app that is not based on the Calendar Provider so that I can have reliable notifications again.
In the past, when we developed a reminder based app we used AlarmManager class and the method setExact() for make the application able to show a notification or anything else at a given date and time in the future. But in Marshmallow and upper it mustn't work because of the annoying doze mode.
They invented the method setExactAndAllowWhileIdle() in Marshmallow supposedly for setting alarms that can bypass the doze mode. But it says that it doesn't let you to put more than one alarm within 15 minutes. In a reminder based app that is a foolishness as the user MUST be able to put as many reminders as he wants and as close in the time line as he wants.
So my question is, how can I make my app to show reminder notifications at a given time in a way that always works regardless of the doze mode and so that I can have as many notifications as I want and as close in time as I want?
Thank you.
There's always the option of white listing your app so doze will still let it run the old way.
Another official way of making it work is sending an fcm notification, but you'd need a server to do the job.
Short from that I'm afraid the next official answer involves exact alarms.
If it's an option for you there is a chance you can start a service with STICKY. I'd expect the phone to never go into doze properly even if the service thread is blocked forever (it may help to assign it to a different process in the manifest so your ui never freezes). Putting a periodic old style Java timer to fire a callback at the right time may accomplish what you need.

Status Bar When Screen is Locked android

I am starting activity with application context when screen is locked. However Status bar is not usable, doesnt get dropped down. Is there any way to make status bar and notifications usable when screen is locked ? (ICS-Android)
No, this cannot be done. This is a security feature of android, if the notification bar could pulled down while the user has the device locked, then it opens the user to security issues as personal information may be in the notification bar such as missed calls, text messages and emails etc.
Well.. GravityBox has an option to allow this.
However I'd be interested on what file you'd have to mod inside the SystemUI/res folder in order to make it work without Gravitybox...

Android Notification Bar icon, is there a way to lock the location of the icon?

I currently have a service driven notification appearing. I am trying to figure out if there is a way to lock the location at which the icon appears. I want to ensure that the icon is always in the same location on the Notification bar, no matter how many notifications appear before or after it. Ideally, I would like to lock it on the right side of the clock and Wifi icons. I am in Ice Cream Sandwich. Does anyone know if this is possible? Thanks all.
Use the Notification.when propperty.
You can locate it the first or the last using really high values (long.Max) or really small ones (-long.Max).
But we are allways talking about the left group.
First, you cannot control the position of your Notification in the status or system bar, sorry.
Second, at least on phones, your Notification will be on the left, away from "the clock and Wifi icons".

hiding GPS notification icon from the status bar

i need to hide the GPS icon from the status bar when my service uses it. I've been making some research and found that it's not possible programatically.
but i found that it is possible if my phone is rooted by installing something on the memory card. anyone can help with the root thing and if it is possible, can it be done programatically without going through the root thing.
thx a lot :D
No, it's not possible to do it with the public API.
Yes, you will need a rooted phone, but that's not enough. You will need to modify services.jar (and perhaps framework.jar also) in order to check whether your service is working or not.
Alternatively, as suggested by Someone Somewhere, you can hide the status bar altogether.
As a side note after the comment below, I would not set up the service to run all the time as it seems you're planning to do. Instead, I would register a BroadcastReceiver to read the SMS and start an Intent upon reception of a specific message. You could hide the status bar in that moment. See this for more details: Can we delete an SMS in Android before it reaches the inbox?

Categories

Resources