Android activity popup on lockscreen - android

Ok, first time asking, I couldn't find a solution anywhere..
I'm trying to create an activity that pops up on the lockscreen, kinda like Handcent does (or even Viber, maybe? Can't remember), but I can't for the life of me find a solution that actually works, be it flags, system alert and such
So far I only managed to achieve a workaround by having a dialog themed app and unlocking the phone before showing it but that's not what I'd like to have in the final product, plus it doesn't unlock all kinds of lockscreen (based on user feedbacks, I've had reports of Handcent successfully displaying a dialog while my app can't unlock it)
Is there any tutorial or code snippet for this?

For Unlocking the Phone programatically this should help.
And as you are already using the Dialog Theme, your application's "pop-up" requirements are completed.

Related

What's the best way to launch a view after device is unlocked?

I'm trying to display a view that the user must dismiss each time they unlock their phone (it's intended to be annoying). It should be able to take a small amount of keyboard input, save it, then return to the previously open activity. I tried having a BroadcastReceiver listen for ACTION_USER_PRESENT and launch my own activity, but then I found out we can no longer listen for implicit intents, or have background services launch activities.
I'm not an Android developer (just trying to build something for my phone), but I did some looking, and I see a few options:
Display a full-screen intent. I think something like scheduling a job to raise a notification whenever the phone is locked, so that the notification appears first thing when they unlock the phone.
Use SYSTEM_ALERT_WINDOW and draw my view as an overlay whenever the phone is unlocked. My only concern with this is how apps like Twilight (which I believe draws an overlay to redden the screen) might interact with it. In those cases, I'd like my overlay to appear at the very bottom.
Are either of those options viable or recommended? Any other suggestions or approaches for how I could accomplish this would be greatly appreciated too. I'm just looking for some guidance on what direction I should pursue.

Alert on uninstalling an android app

When someone is uninstalling my app, I'd like to pop-up some kind of alert or dialog that asks the user why they are uninstalling my app -- kind of like a survey. This way, I can determine why they are unhappy and try to improve it.
I've determined how to detect when my app is being uninstalled using the ActivityManager + getRunningTasks, however, when I try to pop-up an alert using either AlertDialog or Dialog classes, they don't seem to show up. I am able to pop up a toast though pretty easily using the Toast class in Android.
My next attempt is going to create a system alert window -- something like this:
How to open Alert DIalog System level in android
Is there something better though?
Thanks,
J
Official Android Documentation states that you can Listen if another App has been removed, but not your own:
http://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_REMOVED

Launch one activity from another

i just want to know how can i detect if the user opens an app so an activity of mine launches as well.
For example, the user opens the sms app and right after a kind of lockscreen appears.
You can create a service which will run int the background and you can use this API to determine which activity is visible. That's how many app lock works.
As far as I understand the Android system, it is not possible unless you are making a custom firmware.

Showing a alert dialog from the any screen of the android phone

While pressing the power button we are able to see a alert dialog in any android device from any activity. Just like that i want to show a alert dialogue when my application receives a broadcast intent. How i can implement that function ?
Add this intent to your Activity Manifest tag.
In your Activity's onCreate(), Handle the intent you received:
If it matches your intent, show the dialog.
Else, do nothing.
As the previous person stated, you cannot have this functionality, since it is in the Android Framework code, unless you edit that code to expose it. An example of the functionality you are looking for (from Android code) resides in the PowerUI class, which extends SystemUI. In SystemUI, there is a Context(mContext) that sub-classes use to show Alerts on any screen. This is what you need. I had to recently do this for an app. I just mirrored what PowerUI did, and created another child of SystemUI. The PowerUI does this to let you know that your battery is low(from any activity/screen), among other things.
It's a bit of a bear, but that is what I believe you are talking about. Doesn't really help you much though, if you are releasing to the public. But, for a personal app...

Is there a way for me to show a customized message on the lock screen?

I'm using DevicePolicyManager to make an app that can lock devices and was wondering if there was a way to show a custom message on the lock screen if I lock the device with DevicePolicyManager.
There should be a way to show some kind of Activity above the Log-Screen (like the Winamp-App does it).
I found the FLAG_SHOW_WHEN_LOCKED-flag which seams to do just that.
Also, I found this recourse which illustrates how this works.

Categories

Resources