I came to seek help, I have search, read and tried several solutions I came across, but none seem to work for me,
I can't access my local website from the android emulator, using "http://10.0.2.2", but I tried it on other computer, and it works, I'm using Android Webview, does it have something to do with htaccess? How can I determine which htaccess is settings is in effect?
Is there anything I've missed to make it work, btw, when I try to access the local page using the builtin browser, I can access it without any troubles.
Do you have the android.permission.INTERNET permission in your manifest? For more information see: http://developer.android.com/reference/android/Manifest.permission.html
Related
I've read the React Native documentation on the canOpenURL method.
From what I understood I have to add http:// and https:// to LSApplicationQueriesSchemes and AndroidManifest.xml but it worked fine without me adding those values.
E.g. canOpenURL('https://stackoverflow.com/');
I tried to find iOS and Android specific documentation on that but I couldn't find a clear answer to that.
So do I actually need to add http and https to plist and manifest?
No, you don't need to add those schemes.
LSApplicationQueriesSchemes was added to prevent apps from abusing the system to produce an "app inventory" by stealth. Http and https do not reveal anything. In fact there probably isn't much point in calling canOpenUrl for these schemes as you know that you can (Maybe the user could have removed all browsers from the device, but it seems an unlikely case).
Also, note that canOpenUrl doesn't check anything after the method; It doesn't tell you anything about the validity of the domain name or url path.
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
Sorry for the newbie question, but I spent the whole day trying to figure out why the target list remains empty.
This is what I've done so far:
Launched the Weinre host, bounded to my desktop ip adress
(192.168.0.38)
Checked it on Chrome : the host is bounded to
192.68.0.38:8080
Checked that the device is able to access to 192.168.0.38:8080/target/target-script-min.js#anonymous
White-listed both 192.168.0.38:8080 and 192.168.0.38 in config.xml
Added the script call in the index.html
Still the target list remains empty when I launch the app on the device from ADT...
What should I do next?
Thanks!
___ EDIT
I tried the demo, and it's working!
So what makes the difference between calling the script from a demo file, or from the application?
Turns out for me, the problem was that the mobile device silently switched over to another Wi-Fi network (than the one my computer was on), thus rendering the Weinre JS Script unreachable from within the app.
It's different than the issue described above (since, for Yako, the example scripts were working fine), but thought it could help somebody someday.
My issue was that I kept trying to access a page anchor. Apparently that doesn't work too well so I have to load the page first with no anchor, then add the anchor separately.
Finally, it's working!
It seems I only had to wait a little bit after app initalization!??
For all of you who still have to use weinre and have the same problem, I just want to share my mistake:
I did not whitelist my IP-address in the config.xml
maybe some of you have the same mistake.
I'm trying to load the following URL into a webview: index.html?name
This works fine on Android 2.2 device and emulator, as well as Android 3.1 emulator. However, when I load the app up on my Android 3.1 galaxy tab, I am met with an error:
Webpage not available
The webpage at file:///android_asset/index.html?name might be temporarily down or it may have moved permanently to a new web address.
Seems like it's not registering that it's a local asset and is trying to access the web for it. Any idea why this is happening, and only on the physical 3.1 device? If I try to load just index.html then it works fine on everything. I doubt it, but could it have something to do with the question mark?
Thanks in advance.
I had the same issue but there's a workaround...
Change ?name to #name instead and it will work, since named anchors are supported by Android. You can then use JavaScript like the following to detect the anchor and act upon it:
if (window.location.href.search('#name') > 0)
{
// Do something
}
I think you've answered your own question. Over HTTP, the '?' in a URL is used to separate URL parameters from the main URL; although it's interesting that this works with file:///android_asset in the emulators, I'd hesitate to call it a bug.
If you need to pass arguments to the HTML page (perhaps for javascript to use), one option would be to use anchor syntax (e.g. file:///android_asset/index.html#name)
As per the standard, file:// URLs don't support query strings, like your ?name. So this is hardly a bug. What are you trying to accomplish in the first place? Which part of your code is supposed to process the name? If JavaScript, then load the page, then invoke some JavaScript on it via another loadUrl() call with a javascript: URL.
i am developing phone-gap app in android. In app I am calling a servlet returning JSON. Under app code I am calling following method through javascript in index.html
JQuery.getJSON(servleturl,function(data){alert(data)});
When running in emulator the alert is getting displayed, but data is always null. However if i launch the index.html (main application file in phonegap) from browser, I am able to get Json.
same thing happens even if I use $ajax.
please help me and let me know what I am doing wrong.
A little bit later, but I had the same problem today, and I've solved it, so if you didn't sort this problem this would help.
So, the problem is not in JSON or in the phonegap, but it's in the AndroidManifest.xml file.
You should have a tag like this:
<uses-permission android:name="android.permission.INTERNET" />
this should allow your application to work with Internet. Without this connection to Internet from your application is forbidden. That tag need to be placed right after the start tag.
Check Phonegap sample manifest for full list of possible permissions.
hope this will help to someone.
I fixed up (read made the changes to get working under a newer version of node.js) a little tool called ibug that John Boxall wrote that I found useful for debugging on the phone (since there is no real way to do it except debug.log and looking at XCodes console window. Its basically a stripped down firebug lite, and its hosted on github as ibug. Hopefully it will help you figure out why things aren't working.