How to make app work on second use in emulator - android

When running the app in android studio the first time it asks for permission and continues normally but when I run it the second time it just reports an error and stops. The error reported has to do with permissions to the image gallery but cannot understand why since it works the first time and permissions granted. When running app on mobile it works every time. Any help or suggestions will do. Thanks.

Related

Suppress unfortunately app stopped

I'm developing a kiosk type application, running on a rooted device.
One feature of the app is that you must be able to download new versions of the app via wifi. However after running sudo commands to uninstall the app & reinstall the new one, we see the message 'unfortunately app has stopped'.
I'm trying to find a work around. The client does not want this dialog to be shown.
I thought of creating a second application to host on the device in order to display whilst updating and to close again after, but even if the other app is in the background, we would still be able to see the dialog which is against the clients wishes.
Any suggestions?
I doubt that the solution you thought of will work.
You receive the message saying unfortunately app has stopped because it is getting uninstalled while it is still running either in the background or not it doesn't matter.
What I would imagine could be a solution is sending out a command to quit the application you could use force-stop for this.
Take a look at these posts they might help you out
Stopping an Android app from console
Force Close an app programmatically

Permission for Android app works even after it is swiped and stopped

What permission should I enable to make the app run 24/7 like antivirus. I have searched a lot but cannot find a specific answer.
Take a look into Services which runs in background until stopped by user.

How can I get a log file from an Android device when the issue makes the user pull the battery?

I work on an app that runs fine on most Android devices; however, sometimes a user complains that the app repeatedly causes his device to freeze such that he has to pull the battery. What can I do to get a log file from this user so I can figure out what caused the freeze? Ordinarily we ask users to repro a crash and run CatLog immediately following to get a log; however, in this case running CatLog after the battery pull doesn't seem to get us any useful information in the log.
Ask him to hit home and wait a minute or two.
If the device is slow, it might look frozen but it will respond. Android is designed to be robust.

background service makes app crash after unlocking the real device

I am running a background service which checks for some updates from the server every 2 hours in my android app and it works fine so long as the device is the not in the locked state. But once I lock my phone and unlock again I see my device displaying the message that my app has crashed. What could be the real reason behind it. Does it need some permissions to be declared. Could anyone suggest me as to why this is happening.
It can be happening from several causes. But I gonna give my guess: are you taking in consideration the case that your app fails to reach the server? What I mean is that I'm guessing that when you lock your phone, or close it in some way, it can be closing your connection and your app can be crashing because it fetchs the server without connection. Its only a very broad guess...

How to determine why my Android app stopped running?

I wrote a simple Android app that functions as a digital sign -- all it does is download and display a (simple, static) web page, and it automatically refreshes the web page once every four hours, with no user interaction.
It generally runs fine for days or weeks at a time, but every so often (seemingly at random intervals) when I go down to where one of the units is deployed I find that the app has mysteriously stopped running -- i.e. the device has returned to the Android desktop.
I instrumented my app to emit log messages (both by calling Log.i and by writing text to a separate log file) and I don't see any evidence that the app crashed or that it exited intentionally; it just seems that at one point it went to sleep after refreshing the web page (as usual), and was never heard from again. I also did a "adb shell logcat" to examine the device's system log after the fault occurred, and I didn't see any stack traces; but I'm not sure how far back that log goes.
Does anyone have any idea why an app might mysteriously go away? Alternatively, is there a recommended way to debug this problem? Since it only happens once every few weeks, it's difficult to reproduce the fault. In particular, is there a better way than "adb shell logcat" to view any crashes that may have occurred in the last few days or weeks?

Categories

Resources