how to keep app active or restart when killed? [duplicate] - android

This question already has answers here:
How to prevent an android activity to get killed
(3 answers)
Closed 9 years ago.
I'm trying to create an app that sets an alarm if the screen is off for too long. This will be checked in the background every 5 minutes. Unfortunately android kills my app sometimes and I need to keep my app active in the background. What is the best way to do this?
I was also thinking about restarting every 5 minutes if the app is killed. Is this a better way to keep my app mostly active in the background? How to do this? Or is there a better solution for me?
Maybe restarting the way like Facebook does?

I would recommend having a look at Mark Murphy's WakefulIntentService.

I think i fixed it by using a simple service that does nothing except for an infiit loop of logging.

Related

Youtube mini player in Android app programmatically [duplicate]

This question already has an answer here:
Android - YouTube Api player on floating window using service
(1 answer)
Closed 3 years ago.
Want to realize same functionality(mini-player in-app only)
currently, I realized it using fragment on the foreground. But it works only when 1 activity. And if use many activities fragment will be recreated and it's not ok when user watching the video.
So, maybe someone can recommend a better solution/example.
I have checked the solution with widgets(Not for this case).
I realise that you discarded the widget possibility but i would still recommend you check it again in this example.
It shows and updates data on one xml which you could expand on screen and reuse or discard if needed.

App restart when revoke from background after some time?

In my android Application,I have an issue in which if I open app from background after some time (30 or 40 min) , that time my app got restart can any one have suggestion on it.
I have gone through almost question before asking this one,but can't find any suggestion or help.
Thanks in advance, any suggestion will be helpful.

Change the time in android through code [duplicate]

This question already has answers here:
How to set mobile system time and date in android?
(6 answers)
Closed 8 years ago.
Well I searched quit a lot on the new, and I found no good answer for that, unless your phone is rooted.
I am pretty sure you can do this in bash codes, but I have no idea where even to read about that.
I want to make an app with 2 buttons.
1st button will change the date of my phone 1 day forword
2nd button will change the hour of my phone 1 hour backword.
I want that the button will change the clock in the settings of phone
thank you all:)
Impossible for non-system apps that don't have a special permission.
Check out this question

How to set a background on an alarm clock app

In an Android alarm clock app that I want to develop, I want to allow people to have a custom image as the app's background when it goes off, rather than having the device's stock background, but I don't know how to go about it. It might actually be really simple but I am still a beginner (a shocker I know) so yeah does anyone have any ideas??
Just in case people are getting confused, I DON'T want the app to change the person home screen wallpaper, just the alarms background
I haven't started the app yet because as I said I need to know this one thing before i spend a few weeks developing
Kind Regards
Ryan
I believe this question has been asked multiple times before. Did you try searching the site prior to asking? It is a pretty basic question if you are just trying to change the background wallpaper on Android.
Edit based on your comment: See here.

Handle an Activity that is pushed to the foreground [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Listen to ActivityManager events?
Is it possible to know immediately (not by listing / iterating over processes in the background service with intervals) which app (and which activity) has been pushed to the front, perhaps using some kind of broadcast information? I want to know globally which app has been pushed to the front, not just for activities within my app.
It doesn't look like it's possible, at least not without modifying the Android source. Take a look at the source of ApplicationsProvider.
This is a similar question: Listen to ActivityManager events?

Categories

Resources