how to open activity on screen unlock in android? - android

In the application,I am trying to a make activity show when user opens the screen lock (screen unlock) and when activity finish user open screen lock activity run back.I am trying
Intent.ACTION_SCREEN_ON
but it is not working properly. And I also used
USER_PRESENT
but I am not able get expected answer
I tried to find on google but was unsuccessful ,so I am confused how to make this type please tell me fast.

What version of Android are you targeting?
I have been able to get USER_PRESENT working fine on 2.x devices, by declaring it in the manifest.
On 3.x & 4.x I was unable to get it working at first. On these later versions you need to run the activity at least once before the system will allow you to register for the event. This is not needed in 2.x.
Intent.ACTION_USER_PRESENT not received on HoneyComb or ICS (Samsung) devices
android app with service only
I have succeeded with this on 2.x, 3.x and 4.x devices and it works. A simple option for an activity to run, if your app is a background app, is a welcome screen with configuration options on it. This would not be out of place in a background app, and satisfies the conditions.

Related

Qt Application visually freezes after start or return from background

We have a (rather complicated) Qt application, with port to Android. It worked quite OK - until we started trying it on Android Pie.
Sometimes, either after start, or after return from background, application visually freezes - however, logging shows that UI thread is alive, it responds to taps, widgets receive paintEvent()'s and process them. But nothing changes on screen.
Hardware buttons like 'Back' also work - application is able to show 'Are you sure to exit?" message box and it works properly.
Also, you you try to go ot home screen and back to app - most of the time it unfreezes.
Actually, this behavior started on Android 8, but was resolve with a dirty hack - doing hide/show for main widget upon receiving applicationStateChange(Active). But it stopped working on Android 9.
I am completely out of ideas what could we do to produce such behavior, and how to fix that...
After a long and rather tedious debugging we finally narrowed it to a problem in Qt itself.
I've reported a bug: https://bugreports.qt.io/browse/QTBUG-76142
However, I don't know whether it was fixed in newer releases, since we stopped development of Android apps for now.
This is not an actual solution, but shares some ideas. I used QT 6.3 and the same hang/freeze problem occurred in qt android app (arm64-v8a / Qt widgets) after returning from background or after phone auto off when app is opened and after return to phone on. Another consequence is that after sending the app to background, I can't use Google chrome properly (I only tested this app, not other apps). What happened is that it's very slow and scrolling in Chrome doesn't work as usual.
I suppressed this problem with this trick (not a solution): i.e., before sending the QT app to the background, I triggered it to show a message box (from clicking a button) and let message box open. Now the Google Chrome app worked normally. And after dragging the QT app to the front and giving OK to the message box, I was able to use the application as usual. No hang/freeze problem.
Also I read an article from a link (https://lists.qt-project.org/pipermail/interest/2014-November/014218.html) : That is, we can able to modify the QtActivity.java (which can communicate to the QT app) and use the on pause and on resume event. So what I thought is that, If I trigger the app to show Qt message box from this "on pause" event, and automatically close the same in the "on resume" event this hang/freeze can be handled.
But I didn't try above (modify QtActivity.java) because now I switched to QT 6.4 and hang/freeze problem is not present in this version.

Launch an App by key press or a combination of key press - Window phone 8.1, iphone, Android

I am planning to build an app which needs a screenshot. My requirement is to launch the app when the designated key presses are executed. (i.e. like volume up+lock key for taking screen shot in windows phone). My app will then launch automatically for further processing of that image. Is it possible to build or is there any work around for that?
Thanks in advance.
There is no way to build such app for Windows Phone.
Even if an app is running it can't get access to hardware keys except BackKey.
App can't run in the backgroud. After user leaves app it goes suspend and only couple of BackgroundTask can be launched to run in background at that moment.
EDIT
To be clear your app on Windows Phone 8.1 can be done but it'll work like following:
User takes screenshot, goes to gallery and choosing to share it.
Your app must declare that it can receive image (https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh871367.aspx)
User see your app in share list, choose it and than your app gets screenshot and may start to work with it.
Adding on what #khamitimur has posted. You will be able to only list down the third party apps installed within your Windows Phone device programmatically but not to launch them using any hardware parts of the device.
P.s : The developers have not yet been given any access or API to hardware parts in order to trigger events from those.

Android LockScreen customization

Is there a way to change the lock screen in Android programmatically?
If yes, is it possible to create an animation within that view?
Is there a way to change the lock screen in Android programmatically?
No, because there is only one lock screen. On Android 4.2, the user can add app widgets to the lock screen, if the user chooses. You can elect to create an app widget that can be added to the lock screen.
If yes, is it possible to create an animation within that view?
Generally, no. App widgets are not normally animated.
android doesn't officially supports it with a nice API , but there are some solutions for this problem . the best one that i can think of and that will work perfectly on all devices and android versions is this :
you can make an app that functions as a launcher , and ask the user to disable the lock screen.
this way , when the screen is turned off&on , your app will be able to be shown and do whatever it needs .
each time the app is being unlocked , it will send the intent of the home button to the real launcher the user has chosen .
of course , there are other solutions , but as i've tried , all of them have some kind of problem on some android devices and versions . they work by listening to the power off intent , and block the home button by using a flaw they've found in the android source code . you can never assume that it will work on all devices and android versions .
example of such apps are "widgetLocker" and "Picture Password Lockscreen"

Android single app specific os [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Is it possible to configure an Android install to run a single app?
So, basically, I'm currently working on an android application that is intended for use on dedicated tablets inside of classsrooms. While using this app, we don't want the students to back out and go messing around, ignoring what they're supposed to be doing. Is there a way to:
a) Have an app launch on startup, so there's no initial access to the home screen
b) Lock the app so it can't be backed out of, and will be the only thing to run
The only way to achieve what you're looking for is:
Modify Android at the firmware level
Make your app the homescreen replacement.
Option 2 is considerably easier. Basically, you tell Android that your app is the replacement home screen, and then set it as the default on each device. That way, whenever the device is unlocked, your app will be shown, and pressing the home button will only launch your app. This essentially stops the device from opening up any other apps, unless it is done via notifications, which you can take away by making your app full screen. The only possibility left to leave your app now is via recent apps, or a service that launched apps on a device shake or something. You can get around this by making sure that no other app was launched prior to yours, or clearing the recent apps manually. The service can be gotten around by simple not installing any app that does that.
You can look into the default home screen app, which is open source and available at:
https://android.googlesource.com/platform/packages/apps/Launcher2.git
I've done a fair amount of research on this and the options are not pretty:
1) Write your own Android home screen
This one is involved but seems doable. Theoretically you could choose to write a home screen that only includes a link to your app and doesn't allow any other icons.
Try this link
2) Create you own lock screen
This may give you more control over the device, but the only options historically have been to use unpublished APIs that have been now been changed to disallow this.

Android: launching flash app as a screensaver

i am new to android development and had question regarding custom screen saver.
The requirement is for a tablet which will always be plugged in so battery life wouldn't be
an issue. The required app should behave as a screensaver in that during inactivity, the tablet should launch this app which contains a flash file that displays a series of images and video. When activity is resumed then the tablet takes the user back to the program they were using.
Can this be done via an app without requiring any hacks?
cheers,
abhi
There is no concept of a "screensaver" in Android.
There is the lock screen, which can be modified via custom firmware, though AFAIK it is implemented in Java as part of the OS and therefore could not be replaced via a Flash APK.

Categories

Resources