Remote service clean up, launcher screen refresh required - android

the problem is that once a widget of my application is uninstalled, it lkeaves a black message box on the home screen saying unable to load widget, i was wonderring if we could clean the system display our self, is it possbile to add some code/ call to instruct the android frame work to do that, the widget is being consumed by a remote service may be once service is finished/closed we can call some syetem calls, any code for helping out the home reloading will help, Thanks

There is nothing for you to do. The user and the home screen will take care of this.

Related

How does call app works when the call app is removed from task list (aka Overview screen) in Android?

I learned that following is Overview screen.
I clicked the dialer and dialed a number and then swiped the dialer to the right.
But still the call is on like this.
How is this done?
I am a newbie to Android programming. I am thinking if they had used a back ground thread or a separate service or something else, so that it is never killed accidentally. How is this done?
Please help me. Thanks.
I believe it is using the Android foreground service. You can checkout how to run it in the doc:
https://developer.android.com/guide/components/services.html#Foreground
The difference of foreground from background service is when phone is low on memory, system will not automatically close it to release memory, it should be closed manually by user, which is why you need to have a notification as a way for user to close it when you first create it.

How to restart service on power button or at the same time if it is forced close by user using task manager?

I am facing a big issue in android service and I searched more than 3 days but I didn't get any solution so please help me.
Currently I am working on a lock screen based service project that make your phone more secure means no one unlock it easily that's work fine but the main problem is that if my application is forced close by user via task manager then it also force close the service of my app then after that, when user press lock button to unlock his phone then it directly open home screen.
Is there any way to restart my application service after few second or at the same time or at the time is user press power button.
In my app I am also disable default lock screen that,s why if my app is force close then after that no security is worked for phone it directly show home screen that's not good, if my app is forced close then at least it enable default lock screen.
Any one who have idea about this please help.
Thanks in advance.
In Android, it's usually not recommended to start the service on it's own even if it is explicitly killed by the user. I don't think if there is a way to start the service again if the user goes into settings and kills it. BTW did you specify the service as remote?

Android app Widget update new version removes the existing widget

I developed an APP + Home screen widget for Android. Now I updated the app (incremented the version code/name) but when i install, it doesn't automatically replaces the existing widget on screen. It just says "problem loading widget".
Any Idea??
Did you change the class name of the broadcast receiver implementing your widget? If so, don't do that.
There is of course the related use-case where there was a widget loaded on the home page and the user then uninstalls the application that contains the widget and widget config app. I guess this is the same as a new version which must to an uninstall/install cycle.
When that happens, all you see is the "Problem Loading Widget" in a toast-like box on the home screen. As far as I can tell, the widget gets no indicatation that the package is being uninstalled and I guess then the home screen AppWidgetManager thows up a default message.
Not well thought out behaviour on the part of the OS team. I suggest that it would be better to call the widget's onDisbled() and onDestroy() methods and to remove the widgets from the home screen before the package is removed so they can tidy up if need be and the user (non-geek phone user) gets a clean experience.
All I can find is the indication that only the user can remove a widget from the home screen, says commonsguy: Removing AppWidgets programmatically
I sure us developers can handle the odd weird toast, but for non technical "ordinary" phone users this sort of behaviour drives them back to iPhones very quickly.
This is the right behavior to me. As app is installed again, its widgets should be installed again too. If, for instance, there is a new activity to configure the widget, how do you know it as a user ?
There is, indeed, no way to guarantee that a new widget would run at all from this perspective.

Reopening Android App from background with timer or countdown

Can someone point me in the right direction to have an Android Application reopen itself to the forefront after a user has pressed the home key? It should be able to be linked to some kind of countdown (which I already have setup, and runs when pushed to background).
I just can't find the function to force this action
*And yes, this is what the user will want, don't worry, I know this doesn't sound user friendly (forcing open) but in this case the user wants it.
Thanks
I needed the exact same thing before -> an app being displayed upon an event but I was sure I read on the Android developers site that this can't be done and that's what notifications are used for, although starting a new activity does bring an app to front. I found this link however to a NEW_TASK_LAUNCH flag with startactivity that might solve your problem -
http://developer.android.com/guide/appendix/faq/framework.html#4

Widget Update when user switches homescreen

Is there an Event that is fired when an widget becomes visible on to the homescreen. I didn't mean at install time, I mean if the user changes his homescreen by wiping the surface of the phone.
The background of this question is that I setup a timer in a service inside the widget that gets updates from a url but that should stop if the widget is not on the current homescreen.
Freudi
There is a way to do that, you can listen to Intent.ACTION_USER_PRESENT broadcast and update your widget on receiving the intent.
It will be fired when the user unlocks the home screen.
I am using it in my app and works great to update your widgets upon unlock.
No, sorry. There are dozens of home screen applications, some of whom may not even have the concept of "wiping the surface of the phone". A home screen is merely an activity with a particular <intent-filter>.
Not sure if this helps, but I stumbled across this..
WallpaperManager.setWallpaperOffsets() and WallpaperService.onOffsetChanged()
Perhaps you could use this? Set wallpaper offsets and use onOffsetChanged() to get current offsets?

Categories

Resources