How to detect the main cause of app lagging issue? - android

I am an android developer and i created an android app which has a background service running.
I have basically created an app which shows chat heads whenever a notification arrives. user can tap on that chat head and reply to that message without opening native messaging app. (Just Like Facebook Messenger with chat heads).
My app runs very smooth in some devices like Vivo, Oppo. But it lags very much in some devices like Samsung and MI. I don't know what is going on here. My app has clean code and never crashes, it just lags and make the phone slower. on the other hand it runs very smooth in some deices.
I tried google but did not find any useful tips. I just want to know that if there is any way to detect the main cause of this lagging issue in some devices. App never crashes, never got any exceptions, don't have any error in code, but still it makes some deice slower and lags.
If anyone can help me finding the main cause of this lagging issue, then it would be a great help.
Thank you in advance.

you can use android studio profiler option to check whats causing lag in your app:
https://developer.android.com/studio/profile/android-profiler
ref tutorials:
https://heartbeat.fritz.ai/profiling-your-app-with-android-studio-7accc268cb98

Related

React Native: Push notification is freezing up the app on iOS (White Screen)

sadly I am facing problem with One Signal and my react native application. I don't know why but somehow my push notifications aren't working anymore.. But only on iOS.. I have had the same problem with Android too but Android is working again. So, that means that the problem cannot really be the react native code cause it is working on Android.
However, when I receive a notification on my iOS device the screen remains white and the application doesn't crash. This is actually not good cause that means I don't get any crash log.. And you cannot debug iOS devices on a MacBook cause Apple has deactivated to receive push notifications on the iPhone emulator..
So, I don't really know what to do.. All I did was replacing the icons and the splash screen. On both, Android and iOS. Also confusing is, the application gets compiled and build without any problems on XCode..
I have read some issues on GitHub already but none of them are working.. What I am really wondering about is, why it is working on my Android device but not on my iOS device..
I already tried to solve the problem by deleting the node_modules folder and create it again by npm install. However, this didn't fix the problem. I also runned pod install again and checked the OneSignal documentation to double check if everything is correctly installed.. And yes, everything is correctly installed..
You guys have any idea on what to do and how to solve the problem?
After I tap on the notification the app launches and then remains on a white screen..
If the app is running in background and I tap on the push notification everything works fine!
But when I am inside the app and I receive a push notification, the app "crashes" and keeps remaining on the white screen. As well when the app is completely closed and I tap on the push notification.. The app "crashes" and keeps remaining on the white screen also...
You guys can help me?
Kind regards and Thank You!
If you don't have an IOS-Device, but only an Emulator it will become really hard to debug this.
You can give it a try with output some Test-Strings with respones-values at important points inside of your app (e.g. function for recieving Notification, for sending notification ... and so on.)
But if you need more help you have to provide more Information. What Library do you use for Firebase-Notifications (fcm, rnfirebase.io or other)... how did you implement it...
If the app is running in background and I tap on the push notification
everything works fine!
But when I am inside the app and I receive a push notification, the
app "crashes" and keeps remaining on the white screen.
Yes, here you have the Point where to start with your debugging. If receiving notifications in Background work, you're issue might be found on the Event-Handler which listen for foreground notifications.
Did you have a clean Code-Structure, where you use try & catch for all your api-based request (notification-methods)? Then it shouldn't be hard to found the issue by echo some catched errors

Cordova Android App: Screen becomes black while working with app

we're developing an cordova android app with angularJS/Ionic. We installed our app on several devices and everything worked fine for a week or two. But since a few days the app randomly becomes black while in use. You can "resurrect" the app when you click the hardware back-button. It seems like the whole GUI is black but all services are still running.
The next problem is, that we have no access to the devices and our own devices don't show this behaviour.
Maybe anyone here has experienced something similar and can help me work it out or can provide us a few good ideas for logging this kind of errors on android?

Android App is asking to share Bug report? Why is this?

I just learned Android from scratch and built an app with simple process using Android Studio.
The app has one process with repeating Alarm manager which will toast a message after 10 mins. That's it.
However, once I install it on a real device, after an hour or so, the device will ask to Share Bug Report. When I do share it,(via e-mail to my self), it is just a blank black screen..!
This happens with any device. I tried it on 3 devices so far. It is like:
Device before my app: Normal functioning.
Device after installing my app (after an hour or 2): A pop up comes
up with 'Share bug report'.
PS: I have not written any code to call or share bug report or any popup.
Has anyone come across this strange behavior?? Any idea on what is happening here??
EDIT 1: It is not just a blank screen but there is a word doc with lengthy set of code. It basically contains the entire lump of data of entire system. Not just my app..!
Probably your app is freezing or stops responding.
Analyze your app logs, you will find the cause.
Did you read these threads ?
What does it mean with bug report captured in android tablet?
http://android-developers.blogspot.com/2010/05/google-feedback-for-android.html

Why is my Android app using CPU in the background?

I have been writing an Android app for several months now. It is not released yet, but it is installed in my device.
Today I got a notification from the Battery Doctor app about my app consuming a lot of CPU, even though I hadn't used it since yesterday.
So basically my app is running on the background, it should not be doing anything, but it is using CPU.
So I opened up TraceView and did some profiling on my app while it was in the background (I did not interact with my app at all during this profiling time) and this is what I got: http://i.imgur.com/PYg6twX.png
I am very clueless here. I can see no functions at all from my actual code so I don't even know where to start looking. And I don't really understand what those functions in the screenshot do or why they are showing up there at all.
So I got a couple of questions that I would really appreciate some help with:
are my profiling results expected and OK? Or are those functions not supposed to show up if I am not interacting with my app?
if those functions are not supposed to show up, can anyone guess what could be wrong in my app? Could admob be the cause?
Thanks a lot!
I have the same issue
See my CPU profile. My app was in background, but the CPU cumsuming always in 1-5%, it will cause battery drain if continue running like this for long time.
Admob?
As #CommonsWare suggestion, I remove admob dependency and run again. The CPU consuming go down to 0% almost time. See new profile: https://i.stack.imgur.com/bMBuL.png
(admob SDK version: 17.1.2)
But it is not the solution. I check their sample app, it doesn't have CPU comsuming in background.
I fixed it
If you are using banner ad, you have to call atleast AdView#pause or AdView#destroy in corresponding event of the host activity. Otherwise, the ad view keep checking "Active view", and it causes CPU comsuming.

Android - the app keyboard freezes some times

I am developing a chat app using XMPP and asmack library. The issue I am facing is while typing in a chat message, the keyboard some times freezes and then the typed in letters. This is not happening all the time and is happening only twice in ten times...But Still I believe this will be annoying to the users. Any idea how to avoid this or what might cause this issue so that I can concentrate on that particular area in Android....
Any help would be great. Thanks

Categories

Resources