Native Android app starts as Evothings client

Ask, and ye shall receive.
MagnusL
Posts: 9
Joined: 09:32, 25 Apr 2014

Native Android app starts as Evothings client

Postby MagnusL » 22:00, 16 Jul 2015

I try to build my Cordova app to a native Android app. Everything works fine in Evothings Workbench/client app.

Building the app also works fine and i get .APK file in the BTProject/platforms/android/out directory.

But when i move the App to the phone, install it and run it. It starts up as the Evothings client and i need to load the content of the app from EvoThings Workbenck.

What have i missed? I thought i would have built complete app that installs with the .APK.

Regards

Magnus

MagnusL
Posts: 9
Joined: 09:32, 25 Apr 2014

Re: Native Android app starts as Evothings client

Postby MagnusL » 06:49, 17 Jul 2015

OK,
So i got it working by removing: <content src="http://192.168.1.69:4042" /> from the config.xml file.

Is there a way that i can work with the project in Evothings workbench and without changing the config.xml build the project using cordova? s it possible to use multiple config files?

/Magnus

ardiri
Posts: 58
Joined: 16:13, 28 May 2014

Re: Native Android app starts as Evothings client

Postby ardiri » 00:03, 22 Jul 2015

it may be possible your topic heading is a little misleading - but, here goes.

i am under the impression you currently have an evothings application and you want to build it as a native android (cordova) application so there is no need to integrate with the evothings workbench to run your application (ie: you've built something and want to post it to an app store et al). correct? if you want to continue working with the evothings workbench; then you should really continue using the evothings client until you have completed your application implementation.

in any event; i assume you have read up on our starter kit:

http://evothings.com/cordova-starter-kit/

that explains how to take your evothings application; and built it directly within the evothings client such that it can now look like your own and work independently from the evothings workbench. if this isn't what you are looking for, you'll need to explain more clearly what you are trying to do so we can provide some assistance.
// Aaron
Chief Technology Officer
Evothings AB http://www.evothings.com/

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Native Android app starts as Evothings client

Postby micke » 08:51, 22 Jul 2015

Hello Magnus,

I don't think you can set different content tags for development/production builds directly in config.xml.

I would guess hooks are a way to do what you want. Cordova hooks are scripts that run during the build and makes it possible to configure things during build. For example, you could have the setting:

Code: Select all

<content src="index.html" />


in config.xml, and then make a hook to copy the development or production version to the target platform www directory. For development, the index.html file could contain a script with something like:

Code: Select all

location.assign("http://192.168.1.69:4042")


For production it would be the "real" index.html.

Here is an article that describes how to do this:

http://devgirl.org/2013/11/12/three-hoo ... ect-needs/

The technique outlined in the above post is based on setting and environment variable to detect development or production builds. Here is an example adopted from the post:

Code: Select all

TARGET=prod cordova build android


Documentation about hooks:

http://cordova.apache.org/docs/en/edge/ ... ex.md.html

Another blog post:

http://intown.biz/2014/05/13/build-conf ... ing-hooks/

I guess there are other ways to configure the build, like custom scripts (written in Ruby, Node.js, whatever) that patches the config.xml file before starting the cordova build.

Personally, I just edit the config.xml file when using a custom Cordova app with Evothings Workbench, for my needs that is the easiest and quickest approach. But I use hooks for other things, have found them useful.

I find it very useful to hook up a custom Cordova app to Evothings Workbench, use this a lot when developing apps. You can even make a small UI in you app, if you want, that allows entering the address to the workbench. This technique is for example used in the Estimote Cordova plugin example app, see these files:

https://github.com/evothings/phonegap-e ... x.html#L85
https://github.com/evothings/phonegap-e ... lopment.js

Hope the above helps! Let us know how it goes and please post further questions/discussions.

Best regards, Mikael


Return to “Questions and answers”

Who is online

Users browsing this forum: No registered users and 18 guests