Can't Send email through Android emulator - java

I wrote an email app and I am running it on android emulator. Basically this app captures the picture using camera and then sends it to a person through email. But the problem is when I try to send an email or capture an image from the emualtor, I get error FORCE CLOSE. How can I solve this problem? I don't have an android phone to test the app on the phone.
Thanks for your help!

Does the test environment have connection to your SMTP server? Sometimes a firewall will prevent an application such as the emulator to reach a secure source such as the SMTP server.

Configure email client in your emulator. Then try for sending email. Also add necessary permissions such as "uses-permission android:name="android.permission.INTERNET""
in your AndroidManifest.xml.

Related

TCP connection between Android App and PC

I'm trying to create a TCP connection between my PC and Android smartphone to send text from the PC (Client) to the Android App (Server).
I found a tutorial which helped me with the code for the App which creates the server ( http://pastebin.com/z0xPSAvP ).
Now I'm struggling connecting my client with the server. The client is programmed with "AutoIt"
http://pastebin.com/tCW5bK9V
When I run the client the "could not connect to $socket" msg-box is displayed.
Could someone tell me what I'm doing wrong here?
Both devices are in the same Network (smartphone via WiFi and PC via LAN) and I checked for the smartphones IP in the smartphone settings.
First, try to access something like Google from your Android phone using its mobile browser. Maybe something still wrong with the network.
Then create a version of the server that could deliver simple HTTP response, visible from the Android mobile browser. Doing so with success eliminates firewalls and all client-related issues from the list of possible problems, making sure the server works and is accessible.
If it still does not work after you demonstrate connection between server and mobile browser, I would suggest to write the client in Java first using the this tutorial. You can try AutoIt and other more exotic approaches after you get anything working at all.

How to auto pair selected (Laptop) bluetooth device in android

Well, my application is like a server and client relationship.
Laptop Bluetooth device is a server where Java application is running.
Android app is client, which request to server and send text messages.
I have to connect server using android app.
When I try to connect device through my app it ask for pairing.
I want to auto pair this both devices.
I have tried couple of days but didn't get perfect solution.
Please help me out.
Thanks in advance.

GCM Demo on Android Device

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

How does GCM locate a user phone

My question is how does the Google Cloud Messaging know where to send the message to? does it work by IP Address? Is there an interval that runs a function on the phone to send the current location or IP Address of the phone to the Google server? Does anyone know?
Google doesn't need to know the IP address of your device. Instead, your device connects to Google, identifies itself using whatever protocol Google uses for authentication, and Google then uses that established connection to send notifications to your device.
When your phone changes from one IP address to another, it simply makes a new connection to Google, and Google then uses that new connection for your notifications. Google wouldn't even need to keep track of your IP address after you disconnect, since as soon as you disconnect (like on a public wifi system), somebody else might start using that same address.
Here is the link which explains the working of GCM http://developer.android.com/guide/google/gcm/gcm.html
Every GCM client creates a unique device token that you need to send to GCM server for sending the push notifications to client.
Here you can find link explaining the GCM.
GCM Works by Running a Service of its Own to handle Push Notifications.
This service requests the Google Cloud Server (GCM) with your app token ID created by GCM for any pending notifications created by your app and sends the response back with all the notifications from your token id to your app, and this happens for the all the apps using GCM.
So, basically if you have 5 apps which have implemented GCM then their token IDs will be send together by this service and GCM will check if any notification is available for the sent token id's and send them as a response.
Read this thread, this guy has explained it, and GCM is reliable for new app builds !!
http://eladnava.com/google-cloud-messaging-extremely-unreliable/

How does the c2dm application push to the Android app?

I am new in Android and trying to develop an app with push notification. I have a small confusion on the architecture behind the c2dm, that after getting the authentication token and device reg_Id, the application server will send them along with the message, but how will the server will know to send the message to the c2dm server?
I am getting an error and even I am not able to add a google account on my emulator for synchronization. While doing this my emulator says com.android.calender not there.
Thanks in advance.
you have to call web service to sent push notification on particular device. And whatever the massage you want to pass on device is written in web service. you can make web service any any language like php or .net. Ask me if you have any query regarding push.

Categories