turning exit-on-suspend off in phonegap application on Android - android

I wrote an application using Phonegap on Android and ran it directly from Eclipse on my mobile device (Android). exit on suspend config was true.
Now I want to update the application and I'm not able to do that since each time I run the application from Eclipse (to be ran on my device) I get the old version since each time I exit the application it gets suspended and then resumed when launched again.
The update is critical as there are some database information that I need and I'm not able to use the code I wrote to get the information needed since the application is not getting updated on the mobile (it's resuming all the time).
What can be done to force an update to the application without losing the database (SQLite)? I changed the config.xml and turned off exit-on-suspend but it's not doing anything since Cordova is always detecting the previous (suspended) version.
I tried killing the running applications, restarting both the mobile phone and eclipse and adb but that didn't work out.
Is it possible to uninstall the application and install it again without losing the database? If not, how do I updated the application?
Thank you.
EDIT: Typos.

I think the new value (per Cordova 3.3) may be:
<preference name="KeepRunning" value="true"/>.

This is coming really, really late but it might help others...
Just simply Cleaning the project before Running the application by doing the following;
Go to Project Menu
Then click on Clean
Select the current project you are working on and click on Ok
That will clean you project but will not uninstall it and your new updates will be implemented.
Hope it helps, cheers!!!

Related

White screen after saving changes with NativeScript Angular HMR on Android emulator

I created a NativeScript 7.1 project with Angular 11 using tns create my-blank-ng --template #nativescript/template-blank-ng and then run it using tns run.
The app at first runs perfectly, but it only shows a white screen after saving changes which triggers hot reload.
Is there any way to make HMR work? Disabling HMR could be a workaround, but it's to annoying to have the app restart on each change.
I can't comment, but it seems like although they announced that it now works, with Angular it still does not.
I don't think there's any workarounds at this time. We'll have to wait...
Update: There's also an issue on this at: https://github.com/NativeScript/nativescript-angular/issues/2243
Update 2: Fixed, see accepted answer.
It's a bug - fixed in nativescript-angular#11.0.1
Release note:
https://github.com/NativeScript/nativescript-angular/releases/tag/11.0.1

Force Stop Running Application Before Build in Android Studio

I know there is an option to "force stop running application before launching activity" (which I do have enabled) but I'm after a way to have the same program exit as soon as I click the "play" button. I believe this is what use to happen before an upgrade but ever since the upgrade I've been unable to find a way to do it.
The reason I'm after this is because before (when the app closed when I pressed the button) it was really easy to tell when the new edit of my app was up and running on the device. Now that the old version keeps running I frequently make mistakes thinking the new version is already running before it is, or more commonly, not realising the new version is ready thinking the version I am looking at is the old one.
Is there a way to bring back the behaviour I seem to remember having before?
Thanks.
You can disable Instant Run via Settings -> Build, Execution, Deployment in Android Studio
Disable the Instant Run option from Settings as follows:
I think check thd delendencues and any error code written in any java as well as manifest file of application . I have done and my app is running.

Android Studio shuts down forcefully

I am having a good problem with Android Studio. Initially I was using eclipse to develop android App, but eclipse display funny stuffs like deleting all my codes and most times crashes so I decided to try Android Studio.
Now am using android studio, but whenever I open an activity to start typing code, the IDE forcefully shuts down. Initially i tougth this happens when there is an error in your code, because I had an instance where the IDE shut down, was fixed by correcting the errors. But now the codes are all correct and when I install on emulator it installs properly.
But whenever I open an Activity and start to type Android Studio shuts down. I have tried to check for similar question, but could not find anything suitable. Please I need your help because I have a lot of project with deadlines and this AS behaviour is making me run nuts.. Thanks
There might be memory issue with Android Studio. I recommend you to shutdown all the heavy-weight memory consuming application like Chrome etc. to be shutdown.
I hope it will help.
Thanks all I finally got the solution to the shutdown. I had to create all the Activity used from AS and copy the codes into each file created. Initially i copied all the Activities, resources and Manifest I created in eclipse and paste them into AS. I guess AS doesn't perform auto update and this cause it not have have reference of the pasted files in memory making it to crash.
Sometimes some plugins keep running if studio crashes and they consume so much memory that studio is not able to launch again.
Or see if other applications are running and consuming much memory.
Or you can restart the system.

Possible reasons/fixes for build error for Android Emulator

STEPS-TAKEN: Not sure what the source of the problem is, but the quick description of the bug is that:
I install all required software, SDKs, configs,
Then create two new projects each using the tabbed-window template, each of which support deployment to Android.
Then I run one project via Titanium Studio's Run option, let the Android Emulator load, and confirm it's the app is installed an working.
Then I closed the emulator, and then run the other project the same way as the last, though when the app is shown on the screen it has the name of the first app, not the app run.
FIXES-TRIED: I've attempt executing "Project >> Clean" for all projects before the second run, and still get the same "bug".
SETUP: To my knowledge all of my configs are correct, and clearly the build "works" though it is very possible there is something wrong with my installation build chain to get to the point I'm running the app in Titanium Studio via the Android Emulator.
ERRORS: I've reviewed the console output for FastDev, AppInstall, Android-Emulator, etc and have seen no error messages that jump out; meaning I have seen no error messages, except for build.py error after the first script runs saying it didn't find the script running on a port when it attempt to kill it; given the request is to kill itself, and it's not found, I just assume this is a confusing way of saying the script did what it was suppose to do.
Current build: is on Windows-XP-SP3 using TiStudio 2.0.1 build, JavaSDK 1.6, r18-Android, and Android-2.2
Recent emulators have persistent state, so your second launch probably gets back the system you were running before.
You should not have to resort to this on a regular basis unless something is broken in the workflow, but deleting the AVD and making a new one should get you a clean slate.
I believe there is also a startup flag to the emulator which tells it not to use the checkpoint from a previous run, but start from scratch - you could try to change your configuration to use that flag.
A downside to either deleting or forgoing checkpoints is that the emulator will take longer to start up.
Really though, you are supposed to be able to re-install or launch a given application, or install a completely different one, all within the same running of an emulator. You aren't supposed to need a new emulator, any more than you need to go buy a new device (or perform a factory reset on it). So something is not right in the setup, and the best solution for long term productivity is to identify and fix that. Short term of course, you might need to wipe the slate clean if that helps you meet today's deadline.

Android Emulator Debugging, Code will not Update

I'm having a troubling problem testing some code for and Android app. My app has two parts, and activity where the user changes some settings, and a broadcast receiver that responds to SMS messages, both in the same package.
Here's the problem, I first implemented some simple code to test out the broadcast receiver and the activity, and both worked fine. But then as I tried to refine the code, I noticed the emulator wasn't picking up any of my changes. Event went so far as to uninstall the app from the emulator and try again, no luck. Then I added some extra Toast popups to my receiver, nothing, still running the old code. I know its running the old code because its sending out an SMS using a string constant that is no longer in the current code, so it should be impossible that it respond with that value.
Here's the kicker that has me confused. For fun I made a change to my activity. Ran the project from Eclipse and that change showed up! Tried to test the receiver code again, runs the old code that doesn't even exist anymore!!
How in the world can half the package update, and the other half not?
Can anyone help me out 'cause I'm about ready to lose my mind.
I had a similar problem. Changes made to classes imported from another project didn't get picked up by eclipse, but those made to classes in the current android project were.
Making a change to the current android project (inserting a blank line and deleting it) seemed to make eclipse pick up all the changes made and upload the app to the emulator.
I had this problem too, Now I found a working solution. Just follow these steps:
Run your project normally.
When emulator started, run your project again (DO NOT close the first emulator)
Then the updated application will be uploaded into emulator
I can't really be sure what happened but creating an new emulator image appeared to solve the issue.
I don't know why it happens but it's a problem I have all the time.
What I typically do is
Close the emulator
Close Eclipse
Reopen Eclipse
Clean the projects (in Eclipse, select Project -> Clean... -> Clean all projects)
Rerun the emulator
Annoying as hell but seems to work for me.
I'm having this problem too. It mostly happens when errors are entered into the code. The strange thing is if I go back to the original code, Eclipse doesn't revert to the original code. One thing that seems to help is to temporary delete the contents of a file, save, and rebuild, and then enter the contents back into the file, save, and rebuild.
How is one supposed to debug in such an environment?

Categories

Resources