Android Cordova 5.0+ Camera crash - android

We are using Cordova 5.0.0 and its cordova-camera-plugin
When we are testing it on Android, the app crashes when the user takes a photo.
Looking at the links below, it seems that our app is being killed while the camera app it on front.
PhoneGap camera restarts the application
https://github.com/shaithana/cordova-plugin-wezka-nativecamera
While there are some answers but it seems to be outdated: The foreground camera plugin is not suitable to newer devices or Cordova and other solutions didn't work for us
Does anyone have an up-to-date solution?

Try to use this forked cordova-android and cordova-plugin-camera.
The docs, sample and discussion on the approach used can be found in the cordova-android PR.
BTW, the PRs are going to be merged soon.

First question that comes to my mind is: Why using this camera plugin: https://github.com/shaithana/cordova-plugin-wezka-nativecamera
It's obviously a fork. You might have a good reason for that. It's also outdated. Last contribution was one year ago.
Maybe you want to give the "official" plugin a shot:
https://github.com/apache/cordova-plugin-camera
Going deeper into detail without knowing more about your testing environment (which device(s) with which Android version) and without having possibility to review entire related code, is not possible and answers may not give any reliable advice for change.
Have you ensured, that the call to the camera plugin cannot happen before "deviceready" was triggered? Is cordova.js loaded?
Update:
You may also want to switch from raw alerts to console output. I recognized several times that alerts in callbacks triggered from plugins could cause some trouble.
As a general rule of thumb: Use console.log() instead of alert() and connect with Chrome (chrome://inspect) to the emulator or device to see what happens. You can additionally use adb logcat to have a look into the device log.

Related

ANT+ SDK - requestAccess faild (Other failure)

I'm trying to develop own Android application using ANT+ sensors.
My app is based on (developer's Sampler code and SDK).
However I found the strange thing during tests. I mean when I start to searching devices I immediately receive a message:
W/AntPluginPcc: BBD30600: RequestAccess failed: OTHER_FAILURE
At first I suppose that a reason of this problem is that I have a phone with Marshmallow OS (instead my wife's phone is based on Lollipop OS and all works fine). I tried to find anything in documentation related this but didn't find anything interesting. I add to Manifest some permissions (I mean com.dsi.ant.permission.ANT, android.permission.BLUETOOTH etc.) and set the permissions in code, but it doesn't help to me to solve my issue.
May be anybody received this problem and may be somebody solve it. Could you please share your solution to me?
P.S. I install the ANT+ Plugin services, ANT Radio Service. in App I use the ANT+ SDK from github. May be I should use also the ANT SDK? (I want to connect to HRM and cycle devices which use ANT+ protocol)
If you have the same problem as I you need to realize the AntRadioServiceConnection class.
I found it here.
And you should be sure that you have all services and plugins installed on your phone.

Getting an App APK

Hey guys and girls for a the past week I've grown a lot of interest in android studio (even without knowing quite much about it) I decided to create an app that I deemed quite useful. However the app required maps to be integrated in it and I really did not know what I was doing and at one point I started messing with the settings and then all hell broke loose and I kept getting AAPT2 errors and I even tried to fix this issue with the gradle properties line that you add (I forgot the line of code to add). Anyways it still didnt work. However I rembered that I always kept the good version (before I broke everything) of the app on my phone. So when I go in my phone the app is there and it works just fine. Ive tried so many things to get the source code from the app on my phone without any succes. My question is, how can I get the source code back from the working app onto my laptop to continue coding in android studio? If it helps I am using Linux 18.04 LTS and running the newest version of android studio. Thank you for any help from you guys. This means a lot to me.
You can’t get back the ‘source code’ from an already compiled app.
You should consider using some version control platforms like git from the next time

fastlane screengrab and snapshot

I'm using fastlane tools (https://fastlane.tools) for automating all screenshots for my iOS and Android apps. The tool works very well and I'm happy with it. The problem i'm having is that when I have mixpanel events and other analytics running on the app the app will run those events during screenshots. Is there a way to "detect" in code that it's a screenshot event with simulators?
Basically, I want some sort of if statement but not sure how to tell its from fastlane. I have thoroughly read through the documentation and wasn't able to find anything for this, any help is appreciated!
My current solution involves simply checking if the user is running on a simulator or is running in debug mode. In which case, it doesn't perform the code I want to filter out.

Cordova background modes issues on Android/iOS

I've ran into a problem with apache cordova background modes. I need to make an application where my battery level is checked from time to time in the background (if the app is in background), and if it is below some level, then the app should notify you about it. Eventually I've managed to run it on android, with katzer's plugin, it does work indeed, but after a while it shuts down completely and on iOS it does not even work. I've tried other plugins but nothing was helpful. Can you please help me find the problem with this? Also it must work on wp8/8.1 that's why katzer's plugin suited me best. (Not to misunderstand me, it is an outstanding plugin, in fact the only that works).
Here is the code on Pastebin
Also I'm linking the plugin which I'm using at the moment
Thanks in advance

Android causes Cordova apps to restart when using Cordova Camera and Capture plugins

It appears that there is a common failure that happens when Cordova apps are put in the background to use the Camera or Media Capture plugins... the Android activity service appears to look for memory to free up and kills the Cordova activity, so that when the user completes the capture task the app RESTARTS. See SO thread here:
PhoneGap camera restarts the application
This is a total UX fail and would very likely prevent me from releasing my Cordova app. People don't take kindly to their photos getting lost. I am using Cordova 3.3 and a somewhat older version of the Capture plugin as an upgrade a month ago caused breaking changes and I rolled back. Anyway, it appears that at some point someone created a custom plugin called foreground camera that never allowed the app to go into onStop state, which fixed the problem:
https://code.google.com/p/foreground-camera-plugin/
Unfortunately, this custom plugin is horribly out of date (Cordova 2.4). Is it possible for the native Cordova plugins to be modified to prevent this terrible restart behavior? Are there any plans to doing so? Or is it only possible by creating a completely new camera plug-in, from scratch, one that doesn't use the native camera application?
I have posted to the Cordova dev list but no response yet. Any thoughts on how best to resolve this situation are appreciated.
Thanks.
Implementing a proper app lifecycle seems to be the recommended way to workaround this issue:
http://cordova.apache.org/docs/en/dev/guide/platforms/android/index.html#what-makes-android-different
You might be able to use the same camera plugin with your app. Try to reduce RAM consumption as much as possible, prior to plugin start.
Remove hidden DOM nodes
Free JavaScript RAM by deleting unused objects/instances
We had this issues on Android 2.3 phones with little RAM. Freeing all possible RAM finally fixed the problem. The app was paused while taking a photo, not killed and restarted.
I checked several posts with the same question. Tried everything until i found this:
changing button tags for anchor tags in html for the event that calls the camera:
change
<button data-icon="camera" id="btn-get-image">Capturar Imagen</a>
for this
Capturar Imagen
further can be found here.
Cordova app restart after getting picture from capture or photo Librairie

Categories

Resources