I'm new to android programming so please I need your help
I want to make a mobile application that connects to a databse on my laptop through internet without configuring my router
I'm using phpmyadmin in which i created a database, and I made a file called login.php that can make sure of username and password from database
I enabled the port 80 in firewall
now i wrote in eclipse this url : http:"//192.168.1.3:80/Day%20Manager/Login.php"
the ip address is optained by writing ipconfig in cmd and getting the IPV4 address
well it's not working it's giving me NetworkOnMainThreadException
can you help me please
Have a look at this link. This might help. Ofcourse if you are going to need to access it from your application you would have to provide an intermediary php script to get it working correctly.
you said you are using phpmyadmin database, then place your php file in c:/>xampp/htdocs folder, open your browser and enter localhost/login.php then you will get output, in the same way connect to url from program then you will get the data.
note: make sure internet permission in manifest file.
Related
What the title says, basically. I have created a program for managing a database, and it worked perfectly inside and outside of the Netbeans IDE. However, as soon as I move it to another computer it can't access the database anymore. I don't know what the problem is, both computers are on the same LAN so they should be able to access the same localhost.
Your url is:
jdbc:mysql://localhost:3306/javabase
localhost is only valid on your local computer. If you want to access a database on another computer you have to use the hostname or the IP address of this computer.
For example:
jdbc:mysql://192.168.0.110:3306/javabase
I'm pretty beginner with AndroidStudio and java, I know the basics and some additional stuff and how generally java works but.
...creating applications from nothing in java is hard ._.
What I would like to do is :
-I have created a database on my personal computer with the data I need (id, logins and passwords)
I would like to make a very simple app in AndroidStudio, that's important, that would check login and password and display success on login and fail if fail.
I have already created a php script and put it into a simple html website, everything works perfectly but when it comes to an application....oof.
tl;dr
I would need help how to make a simple login system in AndroidStudio and would use the app to log in to my database on my pc (both connected to same network)
Thanks for reading.
an easy begginer approach will be to first add apache dependency in your app:module file then make http requests. Check this sample. https://www.learn2crack.com/2016/04/android-login-registration-php-mysql-client.html
i know there are millions of topics on the net about connecting to a external database, but i don't get the clue which ones i have to follow. probably this is because i am an beginner for java and android programming.
my setup:
-microsoft sql server 2005 on a server connected to the internet
-android app i am working on in java (eclipse)
what i want to try first:
-user gives an input number
-i go search this number and return the data from the database do put in on the screen of my android.
i've been reading alot about json and php scripts but i don't know where to start. this database is also used for other windows aplications, there the database is entered by the windows authentication i was told.
is it possible to also use this windows authentication?
anyway, what to do first for me?
thanks in advance
See answers here: Connecting android with MS SQL SERVER 2008
You should really use a webservice, connecting to the database is not the best practice.
I'm following the Android GCM Demo tutorial (http://developer.android.com/google/gcm/demo.html) and I'm attempting to get the application to work on my Android phone however whenever I run the application on the phone I receive the message:
Trying (attempt 1/5) to register device on Demo Server
Then after 5 failed attempts, I get the error message:
Could not register device on Demo Server after 5 attempts
I am running the GCM Server before trying to run the application, and the GCM Server is running on my local laptop. The following server values have been set in my "CommonUtilities" file in the "app" folder in the GCM-Demo-Client project.
SERVER_URL = "http://192.168.1.100:8080/gcm-demo";
SENDER_ID = "245619476079";
I am aware that this is an internal IP address, however I ran into other issues trying to run the server on my external IP address, and I have got my Android device connected to the same WI-FI network, so I'm unsure why this isn't working.
Help please :).
P.S. If anyone has any advice how to get the GCM-Demo-Server running on my external IP address that would be great! At the moment the only external IP address I can find for my machine is the IP of the wireless modem/router, which only allows me to access the modem/router options (even if I make the GCM-Demo-Server run on that external IP address).
SERVER_URL = "http://192.168.1.10:8080";
use this url, it will register on page:
http://192.168.1.10:8080/home,
not the page
http://192.168.1.10:8080/gcm-demo ,
and can't send message.
Finally managed to work out the issue. Unsure why but after removing "/gcm-demo" from the end of the URL, my device was able to successfully connect to the GCM Server and receive messages. So the final "SERVER_URL" set within the "CommonUtilities.java" file appears as:
SERVER_URL = "http://192.168.1.100:8080";
Also thanks for the tips Nick, managed to get it working my external IP address with port forwarding, making the final SERVER_URL look like:
SERVER_URL = "http://<external_ip>:8080";
Thanks for your help guys :)
Make Sure curl is enabled in php. It Works For Me.
For example, with Ubuntu/Debian server, you need to run this command:
sudo apt-get install php5-curl
After that, restart the Apache server:
sudo /etc/init.d/apache2 restart
with Windows try enabling from wamp settings.
For more on enabling curl refer this
I am using MizuTech webphone when i run it using WAMP server of and other server it says cannot find java applet handler..!.
But if i connect my internet it works fine.
Can you please tell is it necessary for Java applet to use Internet ?
If not could you please tell me how I can get rid from it.
You can definitely run an applet without being connected to the internet.
... as long as all of its jars and code are available locally.
While it may be possible to load the applet from local sources, my understanding of SIP calls is that they generally go via the internet. So the main point of a 'SIP phone applet' is lost when there is no internet connection. It is a like a mobile phone with no signal, or a land-line phone when 'the storm has brought down the phone lines'.