Google Plus Integration in android app - java

I am using Google+ in my app. And I can share content using following code
Intent shareIntent = new PlusShare.Builder(ViewGooglePlus.this)
.setText("Android Testing for Google+")
.setType("text/plain")
.setContentUrl(
Uri.parse("http://androidsolution4u.blogspot.in/"))
.getIntent()
.setPackage("com.google.android.apps.plus");
startActivityForResult(shareIntent, 0);
but it works only when official Google+ client is installed on device.
I want to share content whether official Google+ client is installed in device or not.
I found here that it is possible using this library but don't know how to use it ?
Is it possible? Anybody have an idea? If yes, how can it be done?

You cant share to Google+ if the application is not installed in the device. You can use Google App Engine and Google+ APIs to share the content.
https://code.google.com/p/google-api-java-client/wiki/APIs#Google+_API
One such example can be found here on Git.
https://github.com/imellon/Google-Plus-Android-Sample

I think you should go for OAuth Authentication of Google Plus. This will provide explicit Authentication then Intent based.
In this mechanism, you are creating one WebView and open link of Google login page. When user is login successful, google return an Token, which you can use in your application to work with its different application like Maps, Location, Google+ etc.
Here is link which have demo application.
You need to register yourself with Google Console and put two important information clientId and clientSecrets.
GOOGLE_PLUS("client id","client secret","https://accounts.google.com/o/oauth2/token","https://accounts.google.com/o/oauth2/auth",BearerToken.authorizationHeaderAccessMethod(),PlusScopes.PLUS_ME,"http://localhost","plus","https://www.googleapis.com/plus/v1/people/me/activities/public")

Related

Does android studio have any authentication function?

i'm new to android studio, and i dont know much about it. My question here is do android provide any authentication method like aspx / php (laravel) that check if a user stay logged in and etc.
From what i learnt so far, i have to sign in to my app by receiving json/xml data from my web service, so my app just display the next screen after the id/password is correct? Is there any more security issue that i need to worried about? Aspx authentication do authenticate on every page even after your first login. But after some research i dont see android studio have this kind of authentication. Am i missing something?
You can use Firebase Authentication for sign-in methods and user management.
You can add Firebase to Android Studio in Tools > Firebase.
No there is no default function in android that does what you want, you have to add a new sdk to handle this issue. You Can Use Firebase as Aviad Nemet said. Or you save in the shared preferences that you user is authenticated after login success. Saving in the Shared Preferences is safe.

android google oauth signin redirect url

I'm developing an Android app that uses Google+ signin. I searched in the net and this guide in stackoverflow is really helpful:
Google Account login Integration for android Xamarin
Now, i miss one step.
I created an oauth web client id in the google developers console (not android client id) using the redirect url, like the guide said, http://abcd.com/xyz.aspx , and works. But i can't use it!
So i tried http://localhost (doesn't work) and google urls like urn:ietf:wg:oauth:2.0:oob, urn:ietf:wg:oauth:2.0:oob:auto but i can't even set it in the textbox when i create the client id because is invalid url format (it wants the http://, and yes, it doesn't work as well).
I haven't got a web application with an aspx view to redirect, i'm developing an android app. So what could it be my redirect url?
Thanks for any help!

Access YouTube API without client_Secret

I am trying to use the YouTube Analytics API in an android app I'm writing but I'm stuck.
All of Google's documentation I've read says that I am required to use the client_secret when querying YouTube. However, when I registered my app with the APIs Console it did not give me a client_secret.
my API console
How do I access the API without the client_secret, as well how do I use the refresh token without the client_id. I have been working on this for 4 days now and I haven't been able to find the answer.
Client secret is just an option in Android, you can use AccountPicker
In the YouTube Direct Lite Sample project, there is a great example of usage you can check. It's using AccountPicker to pick account then authorizes though GoogleAuthUtil

User authentication through Google plus in android app

I am working with Android app.
User authentication in app with three way.
First is simple authentication done with query.
Second with Facebook. It also done.
I am working on Google plus authentication. but I am not able find the proper document as provide in facebook app.
Can any one guide me for google plus authentication?
You might want to take a look at "Google Play Services" in the Android SDK (released on 09/26).
Google Play services is a platform delivered by the Google Play Store
that offers integration with Google products, such as Google+ into
Android apps. The Google Play services framework consists of a
services component that runs on the device and a thin client library
that you package with your app.
The following components are included in Google Play services v1 and corresponding client APIs are included in the client library:
OAuth 2.0 authentication
Google+ sign-in
Google +1 button
Here's the link to it on on Googles Developer site:
https://developers.google.com/android/google-play-services/index
To add onto what chrkad suggested, there are also the Google+ mobile APIs:
https://developers.google.com/+/mobile/
and for Android, specifically:
https://developers.google.com/+/mobile/android/
These services will enable you to get the plus.me scope for a given account which you could then use for authentication and user credentials. Using a conventional OAUTH2 flow, you could do this now, it will be easier once the APIs are released.

Android + Google App Engine connection

I'm working on connecting an android app in Java with google app engine. This is my first time doing it. I watched and did the same thing that it was done in this video:
http://www.youtube.com/watch?v=M7SxNNC429U
I have been working and I'm getting the same problem. When creating the project and running it, it runs but it shows me a message that I have to create/add an account, I already register it when creating the project. When I enter my gmail account info it shows me a message saying: "Can not connect with the server". I'm not sure what it is happening, please a ed help on it, thanks for you time and patience.
Careful C2DM is deprecated in favor of Google Cloud Messaging and the latest Google plugin doesn't have the wizard for creating a App engine connected android project
That video is awesome, but there's some useful documentation for AppEngine Connected Android apps too. Specifically in the Creating A New Project section, it explicitly states,
Important: You must sign up for a C2DM account using the same Google account that you use for the Android application you are developing and for the GPE plugin.
You can go back and edit things later so that the account you're logging into the app with is separate from the role account being used for C2DM. But for the code generated by the plugin, they have to be the same account. Also, don't forget you actually have to sign up for C2DM, as it isn't enabled in all accounts by default.

Categories

Resources