Call to my website - Android Software Development

Trying to run php script on my site.
If i put URL and name/value pair into a browser, the script runs and returns info from my database.
However, when I run HttpPost httppost = new HttpPost("http://www.mywebsite/myscript.php");
I get Unknown Host; this is most likely DNS and my namesevers should be getting setup.
So I put in the IP address of www.mywebsite..and it throws a Socket Exception, Permission Denied.
Any ideas? I tried adding android.permission.INTERNET on the Applications tab of Manifest.xml, but that gives me an error and won't even run the program.
Something like "l (pid=3228, uid=2000) requires android.permission.INTERNET" no idea what that's complaining about

Update to those that may encounter same problem....
Adding the permission via the Application tab wasn't correct. I manually added the line "<uses-permission android:name="android.permission.INTERNET" />" before the <application> tag in manifest.xml and it worked fine.
NOTE: I had tired that before and it still gave an error. I shut down my Mac Book Pro and restarted and it was ok...maybe a cache issue.

Related

Ignoring certifications

Is there a way via registry editing or otherwise to set up a device to ignore the requirement to have certified dll's and executables.
This would be temporary just for trying out programs extracted from other roms without having to worry about certifying everything just to see if it works.
Thanks
the policies that control this can be viewed here:
http://msdn.microsoft.com/library/d.../wce51conwindowsmobiledevicesecuritymodel.asp
the "unsigned applications policy" should already be 1.
change the "Unsigned Prompt Policy" to 1 also. I.e. change the following registry entry to 1.
HKLM\Security\Policies\Policies\101a
Note that the web page says that this policy is 4122, but 4122 is 101a in hex.
You may also want to set "unsigned cabs" to 16
(HKLM\Security\Policies\Policies\1005 to 16)
Also, this will not work for drivers that are loaded during booting. I'm pretty sure they must be signed. It's not that difficult to create a certificate, install it on your device, then sign the driver dll so it will work.
you can also change this using the "SecurityPolicy Configuration Service" see
http://msdn.microsoft.com/library/d...lesdk5/html/wce51samsettingsecuritypolicy.asp
Thanks a bunch! good info.

HTC Stocks currency problem

The HTC Stocks app has the best widget of all other currency apps, so I was using it on my 1.5 Hero for displaying the EURO/GBP (EURGBP=X) rate.
After the 2.1 rom update I have a strange problem. When I try to add a new ticker for "eurgbp=x", I get the error message: "Unable to recognize the company name or stock symbol you typed. Please try again." However, this worked in the past like a charm. I have to note that adding "gbp=x" or "usd=x" works fine, with no problem at all.
Maybe this problem is related to an updated version of the Stocks app in the new rom. Is anyone experiencing the same problem? I haven't found a similar thread for a Sense Android phone. The same problem exists in the latest rom of HD2, but people have figured a work-around, by changing a file under "Application Data\HTC\", but this file doesn't exist on Android.
Any help would be more than welcome!
I experience the same problem (although I'm on VillainRom12). Previously adding currencies (EURUSD=X etc) was working, but right now I am unable to find it. This could be HTC problem as it was working fine on 1.5, but this could be also some Yahoo search glitch (I am unable to search for that quotes on mobile version of the Yahoo Finance page, while the desktop version works fine). The only workaround to that was to edit manually SQLite database of Stocks application (but this may require root - I can provide details if necessary). Once I added appropriate entries to the list of stocks, it seems to be working fine (it is displaying my currencies, but the search still does not work).
One other deficiency I found was the fact that graphs are not cached anymore - If I open the application and check for example a daily graph, I need to update it in order to see any chart - each time, even if I switch from 1D to 5D and back. It is also automatically updated each time I visit given tab, if I enable the automatic updates. Previously this app displayed previously cached graph. I'm not sure whether this happens also on stock 2.1 ROM.
Now that you mention it, I have the same problem with the graphs in the 2.1, too. It worked (showed the cashed graph) in the 1.5, but not any more. Blank graph until it updates.
Can you provide me some guidance about how to edit the Stocks' database? At least a link to something similar would be much appreciated. Can I access the phone's system folder without rooting it, through my PC (Win, Linux, whatever)?
eeVoskos said:
Can you provide me some guidance about how to edit the Stocks' database? At least a link to something similar would be much appreciated. Can I access the phone's system folder without rooting it, through my PC (Win, Linux, whatever)?
Click to expand...
Click to collapse
I'm new in the business, so I'm not sure if the root is necessary. You can try it, anyway to see if you will be able to push and pull files from the directory where Stocks stores its database.
Here's what I did:
Enable USB Debugging in Settings -> Applications -> Development -> USB Debugging
Download Android SDK from http://developer.android.com/sdk/index.html
In command line go to subdirectory tools of Android SDK
Close Stocks app and remove Stocks widget from the screen
Connect Phone via USB
... (Beginning of the optional part) ...
Go to Android shell
Code:
adb shell
List any processes to see if there's a com.htc.android.Stock process (like in this case)...
Code:
ps | grep Stock
7605 10007 130m S com.htc.android.Stock
7619 0 2156 S grep Stock
Kill any Stock processes (using the value in the first column):
Code:
kill 7605
Exit to command line
Code:
exit
... (End of the optional part) ...
Pull the Stock database:
Code:
adb pull /data/data/com.htc.dcs.service.stock/databases/stock.db stock.db
Sample output:
Code:
d:\Projects\Android\tools>adb pull /data/data/com.htc.dcs.service.stock/databases/stock.db stock.db
568 KB/s (5120 bytes in 0.008s)
Backup, just in case:
Code:
copy stock.db stock_backup.db
Run sqlite3
Code:
sqlite3 stock.db
Enable headers in sqlite:
Code:
.headers on
List contents of quotes table:
Code:
select * from quotes;
Sample output:
Code:
sqlite> select * from quotes;
_id|_name|_symbol|_price|_change|_percent|_open|_high|_low|_volume|_link|_type|_sequence|_updatetime
2|CHF/PLN|CHFPLN=X|3.08299994468689|0.0116999996826053|0.381900012493134|3.07209992408752|3.08550000190735|3.07010006904602|0|http://m.yahoo.com/htcwf/search?p=CHFPLN=X||0.0|1278490511305
3|USD/PLN|USDPLN=X|3.27649998664856|0.0200999993830919|0.617200016975403|3.25550007820129|3.27959990501404|3.24499988555908|0|http://m.yahoo.com/htcwf/search?p=USDPLN=X||100.0|1278490511305
4|EUR/PLN|EURPLN=X|4.1217999458313|0.0151000004261732|0.367700010538101|4.11250019073486|4.12349987030029|4.10799980163574|0|http://m.yahoo.com/htcwf/search?p=EURPLN=X||200.0|1278490511305
5|EUR/USD|EURUSD=X|1.25789999961853|-0.00469999993219972|-0.376199990510941|1.26170003414154|1.26259994506836|1.25689995288849|0|http://m.yahoo.com/htcwf/search?p=EURUSD=X||300.0|1278490511305
6|EUR/CHF|EURCHF=X|1.33689999580383|-0.000899999984540045|-0.0710000023245811|1.33879995346069|1.33910000324249|1.33609998226166|0|http://m.yahoo.com/htcwf/search?p=EURCHF=X||400.0|1278490511305
sqlite>
Note the last _id (here 6) and add new currency with _id higher by 1 (so here, 7):
Code:
insert into quotes (_id, _name, _symbol) values (7, "EUR/GBP", "EURGBP=X");
Check if it has been added:
Code:
select * from quotes;
Sample output:
Code:
sqlite> select * from quotes;
_id|_name|_symbol|_price|_change|_percent|_open|_high|_low|_volume|_link|_type|_sequence|_updatetime
2|CHF/PLN|CHFPLN=X|3.08299994468689|0.0116999996826053|0.381900012493134|3.07209992408752|3.08550000190735|3.07010006904602|0|http://m.yahoo.com/htcwf/search?p=CHFPLN=X||0.0|1278490511305
3|USD/PLN|USDPLN=X|3.27649998664856|0.0200999993830919|0.617200016975403|3.25550007820129|3.27959990501404|3.24499988555908|0|http://m.yahoo.com/htcwf/search?p=USDPLN=X||100.0|1278490511305
4|EUR/PLN|EURPLN=X|4.1217999458313|0.0151000004261732|0.367700010538101|4.11250019073486|4.12349987030029|4.10799980163574|0|http://m.yahoo.com/htcwf/search?p=EURPLN=X||200.0|1278490511305
5|EUR/USD|EURUSD=X|1.25789999961853|-0.00469999993219972|-0.376199990510941|1.26170003414154|1.26259994506836|1.25689995288849|0|http://m.yahoo.com/htcwf/search?p=EURUSD=X||300.0|1278490511305
6|EUR/CHF|EURCHF=X|1.33689999580383|-0.000899999984540045|-0.0710000023245811|1.33879995346069|1.33910000324249|1.33609998226166|0|http://m.yahoo.com/htcwf/search?p=EURCHF=X||400.0|1278490511305
7|EUR/GBP|EURGBP=X|||||||||||
sqlite>
Quit sqlite:
Code:
.quit
Push the file back to the phone:
Code:
adb push stock.db /data/data/com.htc.dcs.service.stock/databases/stock.db
Sample output:
Code:
d:\Projects\Android\tools>adb push stock.db /data/data/com.htc.dcs.service.stock/databases/stock.db
341 KB/s (5120 bytes in 0.014s)
Restart phone.
See if that worked
I hope HTC (or Yahoo) will be able to fix that, because the above is really a long process...
Anyway, I can't make it work. Entering "ps | grep Stock" gives me a "grep: permission denied" error message. I did some searching and I believe this is what people mean by saying "you need root access", right? I'll come back when I'm rooted (i.e. when I find a decent guide for rooting 2.1).
Thanks for your time & effort man. I really appreciate it.
eeVoskos said:
Anyway, I can't make it work. Entering "ps | grep Stock" gives me a "grep: permission denied" error message.
Click to expand...
Click to collapse
You can try to omit the "optional" part (steps 6-9) - the ps thing was just to make sure that Stock isn't running. But I noticed anyway that it never ran in the background when I closed it on the phone. Try to adb pull and adb push and see if you'll get any permission issues. If you do, then you indeed need a root (sorry I can't check that as I'm rooted)
A couple of days ago I updated the ROM of my HTC TD2, with the most recent one of HTC (WM6.5, Sense 2.5.20113030.0). Afterwards I noticed that I also could not get the stock app to accept the code EURUSD=X.
You mention the following
The same problem exists in the latest rom of HD2, but people have figured a work-around, by changing a file under "Application Data\HTC\", but this file doesn't exist on Android.
Click to expand...
Click to collapse
Can you tell me what that work-around is or point me to it? Hopefully this can help me.
Thank you in advance.
Check this thread:
http://forum.xda-developers.com/showthread.php?t=706732
eeVoskos said:
Check this thread:
Click to expand...
Click to collapse
Thank you for the link (which I am not allowed to repost ).
Last Monday I wrote an e-mail to HTC about this problem and a couple of days later I got a reply. They told me they tried to search for the currency rate (eurusd) and that they got a result. So I tried again and lo and behold I got a result as well. Searching for eurusd=x gave me a result while last weekend it was not working.
So I tried several other currency rates and they all rendered a result, also eurgbp=x. Perhaps it is also fixed for the Android app.
[Extra information added below]
Tried again and nothing
I was connected with a data connection to my carrier, so I switched to my wifi connection. Tried again and... result.
So it seems to be a difference in communication between an ordinary data connection and a wifi connection. Maybe this will help someone
Wird problem. I tried it too on both UK and Greek carriers and on WiFi, but nothing. No result for either of them: "eurgbp=x", "eurgbp", "eurusd=x", "eurusd". I have been trying occasioanly more than one month now.
I think I should drop them an email too...
Why don't you do a soft (temporary) root and make the database entries as described in here? I did it and now I got all the stuff I need, and no trace of root on the device.

[HOW TO] Getting a data connection when you require Username/Password authentication

Some users have reported with the Atrix 4G that they have no data connection (Im looking at you, Dennis!)
I found a URL where someone had experienced a similar issue and found the resolution.
Note: This requires root access.
You need to locate the following file and add your username and password -
/system/etc/ppp/peers/pppd-ril.options
Code:
usepeerdns
connect-delay 1000
# Don't remove the user/password lines. They are required to make PPPD authenticate itself with
# the BP when doing Simple IP (SIP). The BP will replace the user/password strings with the correct
# values when authenticating to the network-side PPP peer.
user [email protected]
password NotUsed
crtscts
lcp-echo-failure 0
lcp-echo-interval 0
ipcp-max-configure 30
ipcp-max-failure 30
ipcp-max-terminate 10
novj
linkname ril
There are several methods to access this, rootexplorer, adb shell, sshd, etc and are covered in other parts of the forums.
You are aswsome for finding this.....Like I said in IRC, never would have thought to look in a settings file deep in the system to fix a data issue (should have been updated from APNs or something as I have never had this problem on any other android device)
how come they made this file??
is there a way to bypass the file? because my provider is using different usernames and passwords for each APN (they have several..)

Problems accessing a password protected website in an android webview

Hi,
i just wanted to write a short webview based app to view a password-protected webpage, so it is not accessable for everyone (without user/pw) from a usual browser. i use android-studio.
In a Browser i access the website by typing it's url and enter username and password in the upcoming pop-up window or by including the username/password into the url like:
<username>:<passwort @subdomain domain tld / folder /
when i used a WebView element trying to load an unprotected website it works fine in emulator and on the real device i've tested it on, but when i try to load a website that requires authetification it works fine on the emulator but doesn't work on my real devices.
My Samsung GT-i9305 shows me the "401 Authorization Required" page i get when i cancel the pop-up.
Code:
//inside onCreate
WebView aWebView = (WebView) findViewById(R.id.webview);
aWebView.loadUrl("http : // username : passwort @ subdomain . domain . tld / folder /"); // i hardcoded the username and pw in the url
i see, it doesn't authenticate using the user/pw-.information from the url.
how can i tell the webview to authenticate with given user/password
but i can't find an other way to tell the webview not to ignore the authentication.
i read to use the "onReceivedHttpAuthRequest (WebView view, HttpAuthHandler handler, String host, String realm)"
but don't know how to get a httpauthhandler that tells the webview to give prestored usernames.
am i stupid?
the developerpages from google can't really help me
has anyone done this before and found a working solution?
M;

[Q] GCM XMPP getting SASLError during auth

Hi,
i have strange problems using GCM service over xmpp
i just use the sample code provided bei Google here:
developer.android.com/google/gcm/ccs.html#implement
sometimes this code works fine, and i get the notification on my device
but sometime i just run into a SASLError:
Code:
SASL authentication PLAIN failed: text:
the cause for this error is, that Google GCM server returned an error:
Code:
text
which is unknown in the smack SASLError enum.
so first i don't know what the root cause is.
when i run this code in a loop, i can see that for n request in a row i receive this error, then after some time, the error is gone and messages are send.
again after some time, i receive the error again.
couldn't explain why,
could it be that there are some Google Servers not working properly ?
when i use the test url:
Code:
gcm-preprod.googleapis.com:5236
at least i don't get the SASLError, instead i just get not-authorized.
but the behavior is the same, n requests works n next requests doesn't
did someone have any idea why this happens ? or having the same problems ?
thanks a lot

Categories

Resources