Get User Name and Channel ID from YouTube API - java

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.

Related

Get details from Android Device Policy after enrolment via Android Management API using flutter

I enroll a fully-managed device with Android Management API using qrCode.
After enrollment, I want to get any kind of detail of enrolmentToken or qrCode that was used to enroll the device, so I can ping my server of the details and update the database accordingly.
I want to implement this in flutter framework.
This thing can be done by implementing pub/sub in which I can subscribe every enterprise to a certain topic and allow ENROLLMENT notification which listens for such notifications.
To identify which enrollment token an admin used during device provisioning, you can use the devices.get method. When using this method, the following fields will provide relevant information about the token:
The enrollmentTokenName field contains the token's name.
The enrollmentTokenData field - if an enrollment token provides additional data, this field contains that data.
Additionally, you can also use enrollmentTokens.get to get more information about the enrollment used. This method gets an active, unexpired enrollment token, and only a partial view of EnrollmentToken is returned (all the fields but name and expirationTimestamp are empty).

Fetch changed/new videos using YouTubeData API

I am using YouTube Data API v3 to authorize a user with my app to fetch the video details from their channels and their subscribed channels and index those details to Elasticsearch.
I'm following this SO Answer to fetch all videos under a channel. Now, I met with a situation that I had to take only new videos in my next fetch. But, when I fetch again it also contains the videos that are already fetched earlier. I didn't find anything on this on YouTube Data API's documentation. I think this requires any token or any cursor field that handles the changes.
Looking for some suggestions.
You can save the 'last fetch date' and then, use /search to filter by date adding publishedAfter as a filter in your request. You hace a lot of filters in the search like the channelId, channel type, etc.

Open and pick a contact from a device contact app

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

How to send direct message via Firebase from user to user?

I am really rookie and need an advice.
I have read documentation, and as far as i understood if you need send direct message, follow next steps:
Make authentification, eventually you get Firebase TokenId and
userId
Send them to your server side and store it in DB
When you are going to send a message you need create json and put
inside topic text and resipent userId so on...
Send this json via HTTP to your server side
When server retrive this json, it should use Firebase API to
create new message bloc child with random name in firebase
Eventually server have to find recipent user in DB by userId that we get from message.
After server will find current recipent user by userId , next we should take firebase tokenId In order to sent notification .
And send recipent user notification with such data - name of new
message bloc child
Recipent will connect to this current bloc and retrive data
It is as i understood this consept, fix me please if smth wrong?
Your suggested approach sounds good. The most important thing to realize is that you require an app server to send a downstream message to a device. Using the database as the communication mechanism between the app and the app server is a popular approach.
You could also use Cloud Messaging's upstream capabilities. But I've never tried that approach, because the database works fine for me and I had little interest in learning yet another protocol (XMPP).
You can read how I implemented it in this Firebase blog post Sending notifications between Android devices with Firebase Database and Cloud Messaging.

How to get Connections of Linkedin profile in android

I am trying to get the Connections or user's friends info from LinkedIn using LinkedIn jar for android and example given in google code, but i wont get Connections using linkedInApiClient.getConnectionsForCurrentUser() this method call it returns null, but i can access user current profile info using linkedInApiClient.getProfileForCurrentUser()
can any body suggest me how to get User connections information in linkedIn in android. Or guide me the the wright way.
I got the solution for the above ask question, what I was doing wrong, was that we have to pass an argument of the ProfileField information we want, like this:
final Set<ProfileField> connectionFields = EnumSet.of(ProfileField.ID, ProfileField.MAIN_ADDRESS,
ProfileField.PHONE_NUMBERS, ProfileField.LOCATION,
ProfileField.LOCATION_COUNTRY, ProfileField.LOCATION_NAME,
ProfileField.FIRST_NAME, ProfileField.LAST_NAME, ProfileField.HEADLINE,
ProfileField.INDUSTRY, ProfileField.CURRENT_STATUS,
ProfileField.CURRENT_STATUS_TIMESTAMP, ProfileField.API_STANDARD_PROFILE_REQUEST,
ProfileField.EDUCATIONS, ProfileField.PUBLIC_PROFILE_URL, ProfileField.POSITIONS,
ProfileField.LOCATION, ProfileField.PICTURE_URL);
Connections connections = client.getConnectionsForCurrentUser(connectionFields);

Categories