Sending mail with an android app - android

I would like to know how to make an android app send a mail with a static text when i click a button for example.
Thanks

You can bounce the message off a web script and have php do the sending for you. It's a hybrid approach android/php, but it allows you to have a little more flexibility and would offload any strains on email sending to the server and not android.

Related

Saving an image for image recognition via REST on raspberryPi

I am doing a project for image recognition. I want to send an image or a video from an android app to the raspberryPi, that is my server (I use flask), and make the recognition on the server and then send back the result to android. I want to do this with REST and python. So how can I do this?
I am new to all of this so any help is really helpful!
Yes, as your raspberryPi server use flask, so you can done the task through HTTP and your android phone browser as client.
raspberryPi as server should have the following api:
Chose a image and upload, then recognition and send the result back.
That all.
Since you are using flask, you need to implement REST endpoint that handles multipart/form-data, the example of such endpoint you can find here.
On the client part (in your case - android app) you need to implement sending of the image to that endpoint, example you can find here.

Reading SMS using Appium on Android

I am trying to automated a flow where I can read sms and then parse the SMS to read the OTP and enter it in another webapp. Looked through all forums but couldn't find an answer.
I am writing code in java and trying to run a webapp on android device using appium.
Can someone suggest how to do it?
If you want to read sms from device in Appium session there is a good approach described in discuss.appium.io
I think you can create several sessions in one test: 1 - to get sms with native app, 2 - open webApp in mobile browser and do whatever you need
This approach worked for me
Suppose your OTP sms is like "OTP is 12345 for your order", and it shows up in your notification panel,
Reach the OTP Screen
Pull down the notification bar ((AndroidDriver) driver).openNotifications();
Wait for this element otpElement with xpath //android.widget.TextView[contains(#text,'OTP is')] is displayed (ie, While the sms arrives)
Use OTPmessage = otpElement.getText() to get the OTP message text
Extract OTP using this code : String OTP = StringUtils.substringBetween(OTPmessage, "OTP is ", " for ");
Close notification panel using ((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.BACK));
I dont think this is a good approach if you are testing the app. It might take lot of time for the OTP to arrive thereby failing your test unnecessarily. Better ask your devs keep the OTP fixed so you don't need to receive it through the sms everytime.
You can add a key to store last OTP in an in-memory storage like Redis or closured Dictionary in your backend language, you will then update this key with the value of the OTP you want to send out via an SMS service provider. The last sent OTP stored in this key should then be exposed via an additional api endpoint in your service, which you would then call as part of your automated script after doing an action that will make the OTP to be sent.
A more reliable and robust modification of this will be to expose an API that retrieves the OTP stored against each phone number, you must have this stored already of course before you could do the verification in-app. This endpoint must only be exposed within a test environment, that's the precaution to pay attention to, or you make the endpoint available only to authorized user roles.

How can I send push notifications from my app on button click to another single user?

I'm looking for a way to send a notification to a single user with a specific phone number upon clicking a button.
Currently, I'm using GCM to send push notifications, but these notifications only function manually.
My code is in Python and was written based on a tutorial.
first of all, i suggest you to change for FCM you may know that are 2 kinds of messages:
downstreams : from app server to mobile app,
upstreams: from mobile app to app server,
im using the next code to send messages to my mobile app from server:
requests.post( set.FCM_URL, json.dumps( dataReq ), headers )
FCM_URL is the route to weathever/send
dataReq is my json object,
and headers are the content-type & autorization.
im using the "requests" library for python you need to import it first
import requests
and with that single line im sending downstream messages...

How I use SMTP mail in Titanium?

I want to send mail through the help of SMTP server. currently I am using CreateEmailDailog but in this, when press Send button then mail is sent.
I want to with any press my mail is send in background. I want to use set recipient, subject and message body default.
any suggestion is appreciated.
There is no ready-made SMTP support in Titanium SDK. You need to implement yourself with using TCPSocket operations.
Check http://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.Network.Socket.TCP for documentation and example code.
SMTP protocol is easy. There are few commands like; EHLO, MAIL FROM, RCPT TO, AUTH LOGIN, DATA, QUIT. You can find all protocol specification on RFC documentations.

Android send an email in the background

I have seen many times the ease of sending an email in the foreground using the Android Intent Action.SEND.
However I need to implement a feedback form which emails us the details on completion. This doesnt really suit the Android Intent because the user wouldnt want to see the generated email before sending.
Does anyone have any sample code which can send an email form the background if we assume the smtp server is lol.does.thiswork and the username = lala, password = po.
Cheers
Possible duplicate of this: Sending Email in Android using JavaMail API without using the default/built-in app and plenty of example code in there.
as an editorial note, anytime an application I am using on a phone sends an email, I personally WOULD want it in the foreground. If its just feedback from a form on your application, you could also use several solutions other than email: a web form in a webview, or create a socket back to a server you host, or a use a webservice etc...

Categories

Resources