Accessing DB from Android Studio

Status
Not open for further replies.

rgsopedr

New Member
Messages
1
Reaction score
0
Points
1
Hey guys!

I am on my final degree project, and I am currently doing an Android app which, among others, needs to access a DB. Explaining it quickly, I have two methods:
1) Call a php file hosted with x10hosting that reads the DB (Working fine)
2) Call a php file hosted with x10 hosting that WRITES the db (Works when I call it manually, but do nothing when called from my app)

I have set the permissions for my IP (Which is the same as the Android's Device I am using, since it is a simulator) and, just for ensuring, I have also enabled all the IPs (Using %) after several failures.

Again, when I myself click on the link(URL --- > http://********.x10host.com/AddUser.php) it works as expected. But it does nothing otherwise.

I mean, the app has the same IP as I do, is it blocked anyway by x10hosting? If it is requested to upgrade to premium to make it work, do you know any similar hosting service which allows remote access to my db?

Thanks indeed for the help guys
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
There's no remote database access, no. But the top of your posting implies that you're using a PHP-based API, which would be fine and dandy, since actual database access is strictly localhost; the remote client is only hitting a web(ish) page.

There could be any number of reasons why the device call is failing. You may be sending a malformed request, or trying to fit into a GET everything you'd ordinarily be doing through a POST on a web page. Are you handling cookies correctly (keeping a session is something you don't need to consider with a browser)? Are you getting any errors, and if so, what are they? If they're 403s, it could be the content you're sending (such as raw SQL), or it could be the "smell" of the user agent (bots aren't well-tolerated 'round these parts for obvious reasons). If 503s or 508s (less likely with the server config here), there's probably a timing issue.
 
Status
Not open for further replies.
Top