BackgroundFetch / Background running app using PhoneGap Build - android

OK I have done a lot of research over the last few days, reading a lot of posts on here. I have build an app that using the accelerometer and geo-location.
Now thanks in part to many different posts on here and other sites I have got most of my app working without any problems.
I now have to get it working as a background app. I am building this for iOS and android, but the main aim is iOS. I know that iOS7 changed a few things but also add support for BackgroundFetch, how do I use that within a app that I will be building with build.phonegap.com?
Now I have found this plugin, de.appplant.cordova.plugin.background-mode but when I added it to the config.xml file, phonegap build says its unsupported?
I know there is a list of areas, What's solution to make task background in iOS same service in Android? , where you can list in your 'plist file' for iOS and state what type of application it is and iOS will run it in the background because its using one of these features.
Now I have read somewhere - not to sure where - that the config.xml is built, when phonegap build runs into the plist file, so somewhere in that file I should be able to state that it is application using this and that, therefore run in the background?
So is there any many of making my app run in the background?
Any help would be most welcome
Thanks
Glenn.

The resources you have found are referring to building apps locally on your machine, not with phonegap build. You will not be able to achieve the functionality you are looking for with PGBuild as they don't allow that level of configuration.
To achieve this you will need to setup a local cordova/phonegap client and build your app from your computer.

Related

Ionic getting to know what was the recently run apps on android

I'm writing a simple android app detection using Ionic (fairly new too as well with mobile apps dev using Ionic). Using this plugin App Availaibility I was able to get a list of installed apps, however is there a way or plugin or is it possible to know what was the recent app that was used in the foreground? Like if a com.android.appname was run, it may be able to detect it? Thanks.
No there is not, I'd assume that there won't be a plugin for this either. In order for the device to know what app has ran in the past, it must hold this data somewhere. I doubt google or apple does anything like this.
or
you can always try and build a plugin yourself and see if its possible.

Easiest way to simulate Cordova plugins?

I'm a relative PHP newbie (10 months) and Javascript absolute novice, so please go easy on me.
I've just started playing with Cordova and have a couple of small apps for use internally within our small business that I could really do with, but testing my code is causing me grief. I've been using Intel XDK with the built in simulator, but it can't simulate SQLite or the FileTransfer plugin.
At the moment, the only way I can see of doing this in XDK would be to compile the app and transfer it to my Samsung mobile for testing, but this seems very cumbersome and will lead to everything taking much longer. I've just found Apache Ripple, but didn't want to spend a day looking into it to find there's a better tool.
Is anybody able to point me at a tutorial page that gives the easiest method for testing a Cordova app with plugin support, please? I tend to work from about 4 different computers, so something web-based that means I can pull the latest version of my code from Google Drive and start working with no setup hassle would be excellent, if it exists.
Cheers
Andy
The Ripple Emulator has similar coverage as the Cordova Simulator. Unlike Ripple, the Simulator can be extended to support specific plugins, but it will require writing simulation code to make that happen. See the cordova-simulate project for details on how to do that.
Otherwise, the next best option (and the most accurate) is to build the app and use remote Chrome DevTools to debug the app (see this XDK doc page for some help with setting that up). It is not necessary to rebuild your app to make this work. If you structure your code so that you can redefine key functions using the JavaScript console, you can actually debug quite a bit without performing a rebuild and reinstall.
Use the interactive JavaScript console to redefine functions within your app and then run those redefined functions directly from the console or restart your app, in situ, using the window.location.reload() function. An example of using this technique can be seen in this video, starting at about 18:30. The video is demonstrating the use of the weinre debugger, but the debugging technique can also be applied to remote CDT when debugging a built app.

Ionic app not looking the same in Android Device as in Desktop Browser

I'm really new to ionic/AngularJS/Cordova app development so I'm facing some issues that someone with quite better comprehension on the subject than me could easily fix.
I successfully installed all the components needed to start developing with the already mentioned frameworks.
After installation, I started playing a little bit with some examples and managed to create a really simple app that just had a side menu.
When I was testing my really simple app using ionic serve command, the app launched in my browser (as it should) and worked they way I was expecting to.
My problem comes when I type the ionic run android command.
The app gets built and everything and after that it gets installed in my Android Virtual Device, which later launches the app with no errors.
But the thing is that the app running in my AVD doesn't look the same as in my browser. It looks as if some styles were missing or something.
I know it might be something really easy to fix that I'm just missing.
Thanks in advance. :)
Ionic framework renders the UI layout based on the platform the app is run to provide close to native look and feel. This is as per the design of the framework. If you want to control the rendering, i.e., to have the same look and feel across all platforms, you can make use of the $ionicConfigProvider service in your app and make appropriate changes. http://ionicframework.com/docs/api/provider/$ionicConfigProvider/
Also to get a feel of how the UI looks in iOS and Android side by side you can use the below command
ionic serve --lab
Read this http://ionicframework.com/docs/cli/test.html for more options on ionic cli

Doubts about Cordova 3.6 webviews, events & updating application

I am using PhoneGap / Cordova 3.6 to build my first Android Application. I have successfully created a static application however I still have a few conceptual doubts, I am listing them below it will be great if someone can help me out with these.
PhoneGap events: Do I require installing any plug-in to access or make use of these events?
Ref: https://cordova.apache.org/docs/en/3.6.0/cordova_events_events.md.html#backbutton
Embedding WebViews: How important is this for creating an application using PhoneGap. Does it improve the performance of the application in any way?
Ref: https://cordova.apache.org/docs/en/3.6.0/guide_hybrid_webviews_index.md.html#Embedding%20WebViews
How can I change the version of Android Application created using PhoneGap: I read that the application version requires to be changed in order to update the application. To do so I went into my /application folder/platforms/android/ in AndroidManifest.xml & edited the android:versionCode & android:versionName to a higher number. However after doing so when I re-build the app using "cordova build" in CLI; the default version number is restored. So am I doing the right thing by updating the version number? or is there any other method to do so using CLI
EDIT: Hi Kerri, as per your advise I changed the version identifier in the config.xml. However when I download the apk file on my phone & run it; it asks me to re-install the entire application & not the updates.
Thanks for your time.
Thanks,
Utpal
No. If you look at the top of that page, it does list a few events added by other plugins, but back button and the like are built in.
Ignore this. It's only useful if you are trying to embed a bit of PhoneGap into a native app. For example, you might have an existing native app that you want to add new functionality to, but you want to do that portion in PhoenGap. You can embed PG in your native app and get the benefits of both worlds.
Check out config.xml in your project root -- there's a version identifier in there.

meteor - phonegap using MeteorRider or "hijack DOM" approach

I've created a meteor.js app which I deploy to meteor hosting service.
I wanted also to make it a mobile app, so I started looking for solutions and came across with this Github repo.
MeteorRider, the approach is straightforward, get your meteor app going, then take your phonegap app srating and then "hijack" the DOM using jquery $.ajax request,
so this is what I've done:
meteor app running on meteor hosting, created phonegap app using phonegap
create my-app changed the www folder as the docs mention
changed the meteorUrl, changed phonegap confix.xml origin access to my host.
run locally on emulator using phonegap local run android.
and nothing happens..
Maybe someone has tried this? Or know how to get this working. I hate iframes this is way. I don't use cordova-phonegap and similar.
I haven't used Meteor with PhoneGap, but this is what I would do to narrow down where the problem is:
Ensure your site works on your device's Android browser (this is what PhoneGap uses inside of the native app).
Point the meteorUrl to a Meteor.js site you know works on your device's Android browser.
Point the meteorUrl to a MeteorRider site that works for other people (you may need to ask the MeteorRider author for this).
Ask the MeteorRider author for the most recent Meteor.js version that he has confirmed works with MeteorRider. You may find that there was a change in Meteor.js that broke it. For example, I could see the new standard browser-policy causing a problem.
Hopefully this will help, or spark an idea of another way to investigate the problem.

Categories

Resources