External resources in phonegap app after build - android

This is my first post on SOF. OK, let's get to the merits...
Im quite new in Phonegap and mobile applications world but i have some expirience with developing in PHP, C#, JS... but in Phonegap iam stuck in early stage.
I download Phonegap app for windows to testing apps, this software create for me fresh project.
Now i add to index html: <img src="http://domain.com/img.png" />.
In desktop phonegap image is visible but after build i see crash link to image icon. I tested this on Andy emulator and on my HTC ONE - the same effect.
I tryed with jquery link, api connection, nodejs+socket.io external resources in my app, in the next step with additional attributs in html markups, in the next step i used many different config.xml combinations (changing/deleting sections with domains ACL).... i have only one configuration file. ( i builded .apk on adobe web page)
...and I still have this problem.
What could be the problem ? What should I check? how should I debug/test ?
thank you in advance and sorry for my English .

try after Addind <access origin="*" /> in your config.xml file

I had this line in my first approach in config.xml and i check this position witch , domain.com, domain.com, domain.com/picture.png and with option "subdomains" ... and this is not issue in this case.
thanks!

Related

Ionic CSS changes are not persistent when after ionic serve / cordova run android commands

I am developping an app on Ionic version 3.9.2, for android tablets. I am working under windows 10 with Visual Studio Code.
In my plaform folder, I have only one device : my physical Android device.
The way I process to fix some CSS details is that I simply launch a
ionic serve command, find my HTML element, and update the main.css file located in the www/build folder (I am not using SCSS).
This works okay until I decide to check if everything looks good on my android tablet : I will launch a cordova run android, and then all the CSS changes are lost - even if I go back on my browser, and launch a new ionic serve.
Please note that I am talking about very basic styles, like colors and font size, not platform-specific styles.
I am not sure this behavior is because of the target device itself; it's looks like the changes will be included successfully on my testing platform until I decide to change the platform, and then the new platform will erase my changes because it's taking over the building process.
Is that possible ?
Maybe should I stop switching between those 2 commands ?
Or maybe should I edit both CSS files (www/build/main.css and platforms/android/assets/www/build/main.css) at the same time, which require a lot more work ?
Any help appreciated.
Oh of course, I shouldn't edit this CSS file.
Instead, edit the right SCSS file inside the SRC folder.
Thanks for your answer.

Meteor mobile application seemingly not loading outside assets

Here is my issue, I am using Bootstrap (twbs:bootstrap), font-awesome (natestrauser:font-awesome) and Avatar (utilities:avatar).
When I load my application in a desktop browser, all assets load fine.
When I load my application in a mobile browser, all assets load fine.
But when I load my application in the compiled (Android) app, font-awesome and Avatar don't load their assets. The reason I am targeting them is they are both reliant on contacting outside sources. font-awesome is served off of a CDN and Avatar retrieves avatars from social networks. I know I can package font-awesome but I can't do the same for avatars so I need to figure this out.
I have looked to see if Meteor does something odd like sandboxing the app to prevent outside contact but I can't seem to find any mention of these kinds of issues. Is there a default security settings that I can set where it would allow my app to 'contact' whitelisted sites? It would be absurd but it is Meteor after all.
I figure someone more knowledgeable in Meteor can point out my error.
There is no code for font-awesome (besides using CSS classes) and there is really no specific code for Avatar besides {{> avatar ... }}
Thank you in advance!
Note, as of 5/30/2017: Please skip to EDIT 2 below unless you want to read the very long and confusing ramblings of my former self. Thank you.
Okay, I was right but not necessarily right about who was causing what (I was kind of right). The reasoning behind it makes sense so I am thankful for that.
Here is what I've determined. Cordova has a whitelist under /res/config.xml where URLs are whitelisted and only those URLs are the only URLs allowed outside of the application.
But, if you try to edit config.xml it will be overwritten by Meteor on build which indicates this config is governed / overwritten by Meteor.
I searched around and found a few things: Meteor / Cordova, Meteor. The second article gives the solution. You must use the package browser-policy to whitelist what URLs you want.
After installing browser-policy, you must include them in a file in /server. I tried installing them inside a if(Meteor.isServer) block outside of /server but it didn't work.
Hope this helped! I couldn't find anything similar to this and I presume others will run into this road block as well
EDIT: This will only fix it for desktop. For my issue, I had to create a top-level file called mobile-config.js and use config settings from this page to whitelist URLs. This change happened in Meteor 1.0.4
EDIT 2:
Here is it said more clearly: You must whitelist all outside URLs that you want to contact inside of mobile-config.js
For instance, if you want to contact google.com from your mobile app, you would add
App.accessRule('https://www.google.com')
Thankfully Meteor has fixed their extreme documentation issue and has now included this on the official documentation here

Weinre do not show target for Cordova Android App running on handphone

I really need some help here...
I have developed a simple app using cordova and I wish to debug the app using weinre for further improvement.
The problem is when i host weinre client and access with browser to http://192.168.0.111:8080/client/#anonymous
the app does not show as a target in the client..
I have insert this script import line at the last part of my index.html
<script src="http://192.168.0.111:8080/target/target-script-min.js#anonymous"></script>
In config.xml, i put <access origin="*" />
and in AndroidManifest.xml, i put <uses-permission android:name="android.permission.INTERNET" />
I have also try to open my index.html with the browser of computer which hosting weinre and it's been indicate as a target. Which mean the code should be working fine.
I have also try to access http://192.168.0.111:8080 and the weinre info page is showing up. which mean the ip is correct and accessible from my handphone.
but I wonder why when i run the app, weinre dint show my app as a target. Do I miss out some important step to allow my app to be accessible?
Please help.
After all I still cannot identified the issue, it might be configuration issue and it might not... any suggestion or answer will be welcome.
and to provide solution for those who have similar situation as me, you can try this https://developer.chrome.com/devtools/docs/remote-debugging.
It's working fine for my case. Besides, it's much easier to setup and more familiar interface. You can even step through your js line by line just like what you can do with your pages.
for the moments, this is the best solution i can get.

Multiple webviews in phonegap projects

I am new to phonegap platform. Have some queries plz help me out.
First of all my question is that "what exactly is cordova cleaver"? plz answer in layman language.
Second if somebody says "each module running through one main webview object" then does this mean that the app has only one webview.
Thanks,
Vishal.
with cleaver you can change a native view to show html
If you want to use cleaver, you have to include cordova as a framework.
in the .dmg you have a pdf explaining the steps to include cordova as a framework and how to use it.
I supose you need cordova installed, because if you don't install it, you can't get the cordova.framework

How to run Sencha Touch Application in Eclipse

i am new to sencha touch & phone gap.i want to run simple hello word app in eclipse.but i dont know how to do it.if any one knows it than let me know fast
Thanks in advance
Aamirkhan I.
UPDATE:
Well there is a plugin availble for eclipse in which we can easily create any sencha,jquery mobile,phonegap project's,just need to follow some steps to integrate that plugin..see MY POST for that plugin guide,i updated my answer just to help other's who don't know how to write sample application in phonegap eclipse.
Thanks
follow this folder structure.
---your application name
-------src
--------------your activity class
-------gen
--------------generated files
-------android2.2
--------------generated files
-------Referenced Library
--------------Phone gap referenct which is placed in the libs folder
-------assets
--------------create folder www
---------------------place your html files & create sub folders for sencha files(
-------bin
--------------auto generated files
-------libs
--------------phonegap-1.3.0.jar
-------res
--------------some auto generated files
--------------create xml folder in that place phonegap.xml and plugins.xml files
-------Android Manifest
-------proguard.cfg
-------project.properties
Start by doing the Getting Started tutorial of PhoneGap on whatever OS you want to work.
http://phonegap.com/start
You should get your Hello World pretty easily
And if you want to go further you can do that great Sencha Touch tutorial :
http://www.sencha.com/learn/a-sencha-touch-mvc-application-with-phonegap/
Hope it helps
I would suggest you to use Apatna studio for the Sencha client development. It helps to build web applications quickly and easily and it is one of the Eclipse based powerful web development engine.
http://aptana.com/
Find Aptana Studio 3 Release Updates site: http://download.aptana.com/studio3-rcp/plugin/update/
Another alternative is Spket plugin for eclipse for Javascript. Spket Update site: http://www.spket.com/update/
Once your are done with the client development, you can follow the below link to build the different version of mobile application builds using phone-gap. Visit here for Phonegap developers reference link

Categories

Resources