I am building an invitation form in which the user can fill an email or use a button that will open a contact app in his device and will get the email of a chosen contact(if email exists). I wonder if this kind of button is possible to achieve in Codename One without listing all the user's contacts in my app.
Thanks!
Itay
According to the official API, you may only use id to retrieve a certain contact using method getContactById(String id).
So, the answer is "No", you cannot get the contact by its email since you don't know the mapping id <> email
Related
I use google oauth2 to authorize users in my spring app. I can retrieve first and last name, email. But I also need to get their phone number and profession (jobTitle). How to retrieve phone number and profession from profile about me?
I used all scopes in application.yml- openid, email, profile, address, phone. There is no information in the (DefaultOidcUser) authentication.getPrincipal() object that I need. Maybe I need to use Google People API for it?
If you are already getting the names and email then all you need to do is add occupation and birthday to the personFields property its a coma separated field so the following should do it.
names,occupations,birthdays,email
The issue will probably be the scopes you are requesting. You will probably need to add.
https://www.googleapis.com/auth/user.birthday.read
https://www.googleapis.com/auth/user.organization.read
I'm using Android to access both the YouTube Analytics API and the YouTube Data API. Currently I have the app working that if I hard code in my personal Channel ID the app can retrieve information about my personal YouTube account.
However, I am using the Android AccountPicker to use GoogleAuthUtil so I have access to the user's email address. Is there a way to query YouTube to return their Channel ID using their email address?
Also is there a way to query YouTube to just receive back the user's User Name? I would like to greet them when in my app.
Thanks in advance!
~Jskuzma
You can call channels->list with "part=id & mine=true"
GET https://www.googleapis.com/youtube/v3/channels?part=id&mine=true&key={YOUR_API_KEY}
Id is the channel's ID.
You can get the video's title from the response under [snippet.title].
You can get the channel's title from the response under snippet.channelTitle.
This title is what you are looking for to greet, but if you want to go deeper you can check if that account is linked with Google+ and use googleplususerid to retrieve more information via Google+ API.
I need a help of how to send a notification from device to other device using the same application by GCM and PHP as a server.
can anyone provide me a simple example of how to register as a user and send message to another user. or provide me anything that will be useful to my application
I think I know what you are talking about. First things first, if you want to send a Google Cloud Message from device A to to device B, you must have the GCM registration Id of device B. (I hope you are not planning on storing device B's registration Id on device A)
Here is one approach
Create a registration page. Take a unique input from user like email address (don't forget to verify it) and get GCM registration Id. Then store this information in server with the unique input (email) as primary key and map it with GCM registration Id.
Now if you want the USER of the app, say user A to send some information to user B (like chatting app) call your PHP method from device A with user B's unique input (email address). Your web method can fetch the GCM registration Id for device B from the input parameter and can send a GCM message. you can get email address of user B, C, D etc. from user's contact book or contacts in the email address (or use social networking SDKs to get email address).
If you want your app to send GCM message from device A to device B without users consent, then also you either need the registration Id or the mapped unique key of device B (email in this example). I don't really see any use in this case. But since you didn't mention any detail in your original question I am giving the possibilities.
you cannot use IMEI number as device A does not know the IMEI number of device B. And as mentioned earlier you cannot store all the registration Ids from USER A, B, C, D.... in device A.
I'm developing a website with using struts2 and hibernate as back end. In many sites after you sign-up, a link will be sent to your email and after clicking on that the registration is complete. I want this feature on my webstie, but I don't have any idea how to do this and how is this working? i needsome example to do this....
I have never messed around with struts, but basically what you could do would be to send an email with a link which directs to a specific page. When a user signs up to your website you could save, amongst other things, the email address of the user, the time stamp of the registration and also a key (could be the hash of the email and password, for instance).
You then construct the link and include the email and key in the query string. Once that the user clicks the link, in your page you make a check to see that the user is still within some time frame (optional) and that the email given matches the given key (which you have stored in the database).
If the email and key match, then activate the account.
This is broad question but I am answering based on verification
1. You need a signup page with form example /signup.jsp
2. After basic fields and email validation, generate a code xyzcode for this email,
3. Send email to user email, using a mail server with a link to your link validation page like
/validate.jsp?code=xyzcode (mail server setup and sending email is beyond the scope of the answer)
4. On validate.jsp check code and validate any email with this code otherwise give respective error message.
There are multiple approaches but I am suggesting one which will be easy and as per standard..
In user table add extra column as Status [which can take two values either inactive or Active]
create one more table(emailauthentication) where columns will be (key,emaiId)..
Now what u have to do is after user click submit with registration data...gnerate a dynamic key..could be timestamp+emailId(or anything dynamic and unique) and create record in user table with status as inactive and create record in emailauthentication table with this generated key and emaiId..now after record is created generate a URL which could be like
<a href="doAuthenticationForUser?authenticationId='dynamicKey'"/>Click to authenticate</a>
Now when user clicks this URL then in the action class or Service for this authenticationId find the emailId and make the column status as active..
It is true it is quite big to answer the question.
I knew one link which has the best answer given by BalusC
Here is link:better answer.
I have implemented in my project. I hope this link will help others.
Thanks for reading.
I am registering user with email address . but i want to send the user a confirmation link where if they click then their email address gets confirmed
I am using java spring MVC hibernate mysql
Among other tools you can use "java mail" package to send emails direclty from your application. Here's the link to API docs Java Mail API
So the scenario could be like the following:
User account is created. It's in unconfirmed state now;
You generate a unique confirmation ID to your applicaiton. The easiest way is to use java.util.UUID.randomUUID().toString(). UUID is a random globally unique value.;
You store the ID (e.g. 0123)+account to the database for future use;
Send the URL+ID (http://yourapp.com/confirm?id=0123) as an email using javamail to the user;
Do not show the ID in browser now;
The user checks inbox and see your letter;
The user clicks the link and request is sent to your site confirmaion servlet;
Confirmation servlet will search for the account associated with the specified confirmation id;
Confirmaion servlet set account to "confirmed state" as obvously the user has access to the specified mail box
Use Java Mail Api to create a e-mail with confirmation. Also, you need to generate unique id to confirm the user - this info can be stored in db. After the moment user clicks on your confirmation link you should set user in 'Confirmed' state.