recognize when application returns from blank screen - android

Is it possible to get know when my application returns to view for user, after blanking screen? In this moment application calls method onResume, and my application has crash. ("has stopped unexpectedly") I know why and I can repair this problem, but I need to know when application returns from blank screen.

If you're talking about the point when user unlocks the device - ACTION_USER_PRESENT is what you need. If this is not the case - please elaborate and post more details

What do you mean by "after blanking screen" ? like if the screen times out and turns off? Either way it will be mostly impossible for us to help you with only the information you've given. Post the code from your onResume() method, also look in the Logcat and copy the stack trace that comes from the exception you're getting. Post that here too. Once you have done this it is far more likely that we can help you resolve the problem.

Related

Where can I find this line of code getWindow().setFlags (WindowManager.FLAG_SECU RE, WindowManager.FLAG_SECURE);

I want to disable flag secure in a particular application after searching I got to know this is the line of code I need to remove.....
getWindow().setFlags (WindowManager.FLAG_SECU RE, WindowManager.FLAG_SECURE);
I am not a programmer or anything no knowledge just a beginner by myself. I don't know where can I find this line of code I checked in androidmenifest.xml but there's nothing. If someone is explaining can you please tell me that after removing this line of code I will be able to screen recording of that application right? Nothing more I have to do? Just remove this line of code?
I tried taichi application too it worked in other applications like jio tv, Remini etc but not in that application. I think The reason behind it can be that application stores id of my phone or imei number at their server and you guys know taichi run its pached application on their platform that's why my application recognise it and error comes out. Now you may know that if I try to download that application in another phone (rooted/nonrooted) and login with my phone number it shows error...
Conclusion- I can't login in another phone with same login id ...the phone must be same which I used to create login id and pass in the beginning....HELP PLEASE
you can use getActivity() or requireActivity() before.getWindow()
this getActivity() will return the Activity this fragment is currently
associated with.
Example from Activity
getActivity().getWindow().setFlags (WindowManager.FLAG_SECU RE, WindowManager.FLAG_SECURE);
Example from Fragment
requireActivity().getWindow().setFlags (WindowManager.FLAG_SECU RE, WindowManager.FLAG_SECURE);
Those lines should usually be applied in an Application class if the whole app can't be screen recorded. If only certain screens are secured, check the Activity or Fragment classes.
Despite all that, you can just use the software srcpy on your PC to connect your phone and screen record it even when FLAG_SECURE is set.

ParseInstaller.getCurrentInstallation().saveInBackground() is freezing my application

I am finding that about 1/5 of my tests are freezing, and after some searching for the problem I have narrowed it down to the line:
ParseInstallation.getCurrentInstallation().saveInBackground();
I am using Parse 1.5.1, and an Android 4.4.2 device. My application class looks like:
public class InitApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
Parse.initialize(this, "my_App_ID", "my_Client_Key");
PushService.setDefaultPushCallback(this, MainActivity.class);
System.out.println("execution DOES reach here");
ParseInstallation.getCurrentInstallation().saveInBackground();
System.out.println("execution DOES NOT reach here");
}
}
The behaviour on my device is that I will first see a blank white screen for about 5 seconds, and then the screen goes black. I am not sure how long the screen stays black, as I usually force close. I've let it sit for about 10 minutes once with no change. I am unable to press the back button and any touch on the screen does nothing. I am forced to use my home button, then force the application to close. Upon reopening the application, it behaves and functions normally.
Further research led me to find this post: https://www.parse.com/questions/android-saveinbackground-lock-the-main-thread
But still, I have been unable to find a solution. One suggestion in the above post is to simply move the location of this code. I have tried this to some point after my main activity's onCreate() method (not to be confused with the application's onCreate() method). Behaviour appeared to be normal up until I got to the point where the getCurrentInstallation.saveInBackground() code is called, where my application froze and failed to respond until I forced it closed.
Are there any solutions to this problem?
I encountered the same problem as well using Parse SDK 1.5.1.
And I just downloaded the latest SDK 1.6.0 and problem solved.
Link to download the latest SDK.
You can track reported issue here:
Parse installation save causing app freeze
I already provided (confidentially) thread dump traces from my app. However at time of writing this post there is no useful feedback from Parse guys.
My humble opinion after looking into traces is a deadlock causing this issue after some trouble with server interaction. But it's just guessing.
Link updated
I do have the same issue and more.
The blank or black screen however happen not to all my test phones. It happens only to one of them (Android 2.3).
SaveEventually also does not work to the problematic phone above (all the other phones I have are working fine). It does not send data through successfully to the server. So I suspect that phone configuration of saving data on the phone itself before passing to the server when network is back on may be the issue.

Remove the Unfortunately the app has stopped message in android(Not its cause, but message itself)

Is there any way I can get rid of this message despite the app being stopped due to any exception?
My app(background service) is designed in such a way that it always restarts itself within 1 mins in case it gets killed. So even if it gets stopped, it would be restarted again, with no negative impact. Hence that message would unnecessarily annoy/worry the users.
As the app works fine on my device, but on other's device, its giving that message once or twice a day. I have no way to read the logs and check whats going on. I have placed the try/catch block everywhere. And the code is too complex to dig into again and check whats wrong. In short, I don't want to get rid of the "cause" off the message. But the "message" itself. Is it at all possible?
So How do I get rid of android OS showing that message even if it has "stopped"?
So even if it gets stopped, it would be restarted again, with no negative impact
There is no way to know whether or not there is a "negative impact" until the source of the problem is found.
I have no way to read the logs and check whats going on. I
Use crash logging frameworks like ACRA to collect stack traces from production apps.
And the code is too complex to dig into again and check whats wrong.
Use the crash logs from crash logging frameworks like ACRA to identify the source of the problem.
Is it at all possible?
Read the documentation for your chosen crash logging framework and see what the options are for user notification regarding such crashes. Some, like ACRA, will offer a "silent" mode where the crash is logged but without informing the users of that crash.
Theoretically, you could set up your own Thread.setDefaultUncaughtExceptionHandler

how to stop logs generated from/about my application

I want log collector to do not display any/minimal of the information about my application.
To achieve this I am not printing any logs from my application , and took care to my code should not generate any exception.
But still I am observing some logs about my application in Logcat.
I know this requirement is strange , but I really need this.
is there any way to tell Logcat to it should not display any information about my app..??
Pl. help me in this.
No, this is not possible.
If you want a "empty screen", then you can just create a filter (green + sign in LogCat UI).

Show Toast on Missed Call in android application

i want to show a Toast in an Activity when a missed call happened. How can i do it?
Thanks in advance.
I suppose you have content providers to access call logs.
http://www.anddev.org/video-tut_-_querying_and_displaying_the_calllog-t169.html
http://www.devx.com/wireless/Article/41133
If this code works you just need to run this query at the right time. I mean check some samples that can notify you when you get a call in your device
http://groups.google.com/group/android-developers/browse_thread/thread/d97a759a3708cbe3
Once you get this notification put a timer or use some built in Intents to find that the phone is back to normal state and access the call logs...
There was a similar question recently, the answer should work for you as well:
broadcast receiver for missed call in android
showing the toast afterwards should be the easy part :)

Categories

Resources