Re: [android-developers] Google App Engine and Users API and android

2012-06-26 Thread Arun C G
Hi,

Does this plugin work if the appengine portion is hosted on googleplex and
not on appspot?  I am able to use it successfully on appspot, but not on
googleplex.  I am logging in into the app using a google.com account only.

Arun.

On Wed, Jan 11, 2012 at 12:32 PM, Sriram Saroop  wrote:

> +devx-gpe-eng - any thing to add ?
>
> I don't think you can create a App Engine connected Android Google 3
> project. However, GPE does work in a "limited" way in the Google3
> environment.
> More info here:
> https://sites.google.com/a/google.com/google-web-toolkit/Home/gpe
>
> - Sriram
>
> On Tue, Jan 10, 2012 at 8:26 PM, Brad Abrams  wrote:
>
>> Sriram -- any suggestions here?
>>
>> ..brad
>>
>> On Mon, Jan 9, 2012 at 10:25 PM, Arun C G  wrote:
>>
>>> Hi Brad, Xavier,
>>>
>>> I saw your video on the Appengine-Android eclipse plugin.  It is
>>> precisely what we need for our project.
>>>
>>> Do you have any suggestions to convert the two projects generated by the
>>> plugin into google3 projects easily (better still if you/someone has
>>> actually done this)?  Needless to say, if this conversion is difficult, one
>>> is put off from using this plugin.
>>>
>>> Thank you in advance,
>>> Arun.
>>>
>>> On Sun, Jan 8, 2012 at 9:48 PM, Kostya Vasilyev wrote:
>>>
  John,

 You may want to watch this:

 http://www.youtube.com/watch?v=M7SxNNC429U

 Google I/O 2011: Android + App Engine: A Developer's Dream Combination

 The video covers this plugin for Eclipse:

 http://code.google.com/eclipse/

 ... which makes it very easy to create Andorid apps that talk to a GAE
 backend, complete with device-to-GAE authentication and C2DM.

 -- Kostya

>>>
>>
>
>
> --
> Sriram Saroop |  Product Manager, Google | +91-9900065945
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-11 Thread Sriram Saroop
+devx-gpe-eng - any thing to add ?

I don't think you can create a App Engine connected Android Google 3
project. However, GPE does work in a "limited" way in the Google3
environment.
More info here:
https://sites.google.com/a/google.com/google-web-toolkit/Home/gpe

- Sriram
On Tue, Jan 10, 2012 at 8:26 PM, Brad Abrams  wrote:

> Sriram -- any suggestions here?
>
> ..brad
>
> On Mon, Jan 9, 2012 at 10:25 PM, Arun C G  wrote:
>
>> Hi Brad, Xavier,
>>
>> I saw your video on the Appengine-Android eclipse plugin.  It is
>> precisely what we need for our project.
>>
>> Do you have any suggestions to convert the two projects generated by the
>> plugin into google3 projects easily (better still if you/someone has
>> actually done this)?  Needless to say, if this conversion is difficult, one
>> is put off from using this plugin.
>>
>> Thank you in advance,
>> Arun.
>>
>> On Sun, Jan 8, 2012 at 9:48 PM, Kostya Vasilyev wrote:
>>
>>>  John,
>>>
>>> You may want to watch this:
>>>
>>> http://www.youtube.com/watch?v=M7SxNNC429U
>>>
>>> Google I/O 2011: Android + App Engine: A Developer's Dream Combination
>>>
>>> The video covers this plugin for Eclipse:
>>>
>>> http://code.google.com/eclipse/
>>>
>>> ... which makes it very easy to create Andorid apps that talk to a GAE
>>> backend, complete with device-to-GAE authentication and C2DM.
>>>
>>> -- Kostya
>>>
>>
>


-- 
Sriram Saroop |  Product Manager, Google | +91-9900065945

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-09 Thread Arun C G
Apologies if you have found such a conversion straightforward.

Arun.

On Tue, Jan 10, 2012 at 12:02 PM, Nikolay Elenkov  wrote:

> On Tue, Jan 10, 2012 at 3:25 PM, Arun C G  wrote:
> > Hi Brad, Xavier,
> >
> > I saw your video on the Appengine-Android eclipse plugin.  It is
> precisely
> > what we need for our project.
>
> Why did you decide it's a good idea to hijack this thread to post an
> unrelated
> question?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-09 Thread Nikolay Elenkov
On Tue, Jan 10, 2012 at 3:25 PM, Arun C G  wrote:
> Hi Brad, Xavier,
>
> I saw your video on the Appengine-Android eclipse plugin.  It is precisely
> what we need for our project.

Why did you decide it's a good idea to hijack this thread to post an unrelated
question?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Google App Engine and Users API and android

2012-01-09 Thread Arun C G
Hi Brad, Xavier,

I saw your video on the Appengine-Android eclipse plugin.  It is precisely
what we need for our project.

Do you have any suggestions to convert the two projects generated by the
plugin into google3 projects easily (better still if you/someone has
actually done this)?  Needless to say, if this conversion is difficult, one
is put off from using this plugin.

Thank you in advance,
Arun.

On Sun, Jan 8, 2012 at 9:48 PM, Kostya Vasilyev  wrote:

>  John,
>
> You may want to watch this:
>
> http://www.youtube.com/watch?v=M7SxNNC429U
>
> Google I/O 2011: Android + App Engine: A Developer's Dream Combination
>
> The video covers this plugin for Eclipse:
>
> http://code.google.com/eclipse/
>
> ... which makes it very easy to create Andorid apps that talk to a GAE
> backend, complete with device-to-GAE authentication and C2DM.
>
> -- Kostya
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-08 Thread John Goche
On Sat, Jan 7, 2012 at 6:04 PM, John Goche wrote:

>
> Hi Nikolay,
>
> On Sat, Jan 7, 2012 at 5:39 PM, Nikolay Elenkov  > wrote:
>
>> On Sun, Jan 8, 2012 at 1:32 AM, John Goche 
>> wrote:
>>
>> >
>> > Now that you have mentioned AccountManager I have found the following
>> site:
>> >
>> > http://gnuc.in/resources/archives/1404
>> >
>> > I don't know much of what this token is or what it is for.
>>
>
Chapter 15 of the following book mentions the AccountManager:

http://www.amazon.com/Android-Action-Frank-Ableson/dp/1617290505/ref=sr_1_2?ie=UTF8&qid=1325965851&sr=8-2

Basically android can store information from various accounts including
usernames, passords, and auth tokens which
are used so that a user does not have to login again and again (although
these auth tokens can expire depending on
what service they are used to connect to). The book explores authenticating
to LinkedIn from android. The examples
seem to use some OAuth variables with an API specific to LinkedIn. Not sure
how much of this stuff applies to what
I am trying to do. Here the code goes: AccountManager am =
AccountManager.get(ctx); String authToken
= am.getUserData(account, LinkedIn.AUTH_TOKEN); String authTokenSecret =
am.getUserData(account,
LinkedIn.AUTH_TOKEN_SECRET); etc...

Apparently the AccountManager can present an activity to the user where the
user can enter credentials?
Presumably I can use this activity rather than making up my own?

Most references to AccountManager I find in the literature have to do with
the Contacts API since each
contact is tied to an account, such as Chapter 27 of Pro Android
3does
an AccountManager.get(ctx).getAccounts()
and iterates through them printing ac.name and ac.type.

There seem to be no books that describe the subject and all of the
information pertaining authenticating to google
accounts for using app engine seems to be on the web.

Interestingly enough, when a user configures an android phone the user is
asked for the credentials of a google account,
although the user may later enter other accounts as well. So assuming the
user has only one google account the following
code may work to retrieve the account:

AccountManager mgr = AccountManager.get(this);
Account[] accts = mgr.getAccountsByType("com.google");
Account acct = accts[0];

and then

mgr.getAuthToken(acct, "android", null, this, null, null);

to retrieve the token?

Anyways, now instead of having the user specify a username and
password for google accounts, I now hoave the user specify an
account. I will keep on reading http://gnuc.in/resources/archives/1404
and see if I can make more sense of it, it's quite a lot of info to digest
but well written it seems, but

right now I am not understanding the presumably Java syntax:

public static void setAuthCookie()
{
Auth.background()
{
@Override
public void run()
{
  ...
}
});
}

What is Auth.background()?

Can someone please explain the Auth.background()
syntax? I'm not familiar with it.

Any feedback sincerely appreciated,

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Google App Engine and Users API and android By Nikolay Elenkov - 8:38am - 3 authors - 9 replies

2012-01-08 Thread kk
Hi!
I am developing Live Wallpaper for Android and stumbled upon scrolling
wallpaper issue.
We have
onOffsetsChanged(..) function with xPixelOffset argument.
Question is, what is the maximum value of xPixelOffset value and is it
documented somewhere? Many people considered it to be (screen width *
2) and successfully used it. I myself get same result (-480 with
screen width = 240). But is it the same for every device and will it
be the same?
I just couldn't find official documentation on this and i can't
understand the logic behind this. Phone has X home screens and screen
width = W. So why can't maximum offset be say, X*W instead of 2*W?
And another question is, doesn't it mean that total width equals 3
width? Considering that real drawing area starts with 0  and ends at W
and maximum offset is 2*W, last screen ends with point of X = (W +
2*W) = 3W.
I just can't work with 2*W value now because i don't know yet whether
it's a requirement for maximum offset on every device or is it just
some of them.
Thank you and sorry for my English.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Google App Engine and Users API and android

2012-01-08 Thread John Goche
I also found these links:

http://code.google.com/android/c2dm/

http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html

Not sure whether the latter link is relevant.

Also not sure what the difference between using C2DM and using the Channel
API is.

And not sure why the google accounts authentication method is not mentioned
on the
following page:
http://code.google.com/apis/accounts/docs/GettingStarted.html

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-08 Thread John Goche
Thanks for the link, I didn't realize that the eclipse plugin

http://dl.google.com/eclipse/plugin/3.7

which I am using has a feature whereby you can

File -> New -> Other -> Android -> App Engine Connected Android Project

The video discusses RPC (remote procedure calls) and C2DM (cloud 2 device
messaging).

C2DM seems interesting as it allows the server to notify a device when some
data needs to
be pushed to a device. I wonder what would happen if a device was ofline
when C2DM kicked in.

To be honest much of the video was over my head, but I'm going to try and
have a look at that too.
I got the following URLs out of the video (shown towards the end):

http://bigdaddy-io.appspot.com/
http://code.google.com/p/cloud-tasks-io
http://cloudtasks-io.appspot.com/ 

I'm going to have a look at these too,

Regards,

John Goche

On Sun, Jan 8, 2012 at 5:38 PM, Nikolay Elenkov
wrote:

> On Mon, Jan 9, 2012 at 1:18 AM, Kostya Vasilyev 
> wrote:
> >
> > Google I/O 2011: Android + App Engine: A Developer's Dream Combination
> >
> > The video covers this plugin for Eclipse:
> >
> > http://code.google.com/eclipse/
> >
> > ... which makes it very easy to create Andorid apps that talk to a GAE
> > backend, complete with device-to-GAE authentication and C2DM.
> >
>
> Completely forgot about this one. This is actually using a GWT endpoint
> on GAE, so you can't have multiple versions of an API and it's not very
> flexible, but should work for a quick start. If you don't want to use GWT
> RPC, you can't use this.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-08 Thread Nikolay Elenkov
On Mon, Jan 9, 2012 at 1:18 AM, Kostya Vasilyev  wrote:
>
> Google I/O 2011: Android + App Engine: A Developer's Dream Combination
>
> The video covers this plugin for Eclipse:
>
> http://code.google.com/eclipse/
>
> ... which makes it very easy to create Andorid apps that talk to a GAE
> backend, complete with device-to-GAE authentication and C2DM.
>

Completely forgot about this one. This is actually using a GWT endpoint
on GAE, so you can't have multiple versions of an API and it's not very
flexible, but should work for a quick start. If you don't want to use GWT
RPC, you can't use this.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Google App Engine and Users API and android

2012-01-08 Thread Kostya Vasilyev

John,

You may want to watch this:

http://www.youtube.com/watch?v=M7SxNNC429U

Google I/O 2011: Android + App Engine: A Developer's Dream Combination

The video covers this plugin for Eclipse:

http://code.google.com/eclipse/

... which makes it very easy to create Andorid apps that talk to a GAE 
backend, complete with device-to-GAE authentication and C2DM.


-- Kostya

08.01.2012 18:43, John Goche ?:


On Sun, Jan 8, 2012 at 3:20 PM, Nikolay Elenkov 
mailto:nikolay.elen...@gmail.com>> wrote:


On Sun, Jan 8, 2012 at 9:24 PM, John Goche
mailto:johngoch...@googlemail.com>>
wrote:
>
> Hello,
>
> I am still trying to authenticate to app engine using  google
accounts
> and would like to figure out the details of how such
authenticator works.
> How do I detect in my servlet that the user has authenticated with
> google accounts?

Read the App Engine documentation first. Then start searching for
random examples.


Hi, the relevant App Engine documentation on the server side seems to 
be this one
for the Users service (nothing specific to android on the client side 
here):


http://code.google.com/appengine/docs/java/gettingstarted/usingusers.html

As I mentioned there is this site also from google:

http://code.google.com/p/google-api-java-client/wiki/AndroidAccountManager

I tried running the code with some modifications as follows but I get 
the following
error message when I try to run the code on a device (on the emulator 
it works

but there are no accounts):

[2012-01-08 15:25:26 - ComNet] Starting activity 
com.foobar.hello.StockActivity on device 80A358189040054719
[2012-01-08 15:25:27 - ComNet] ActivityManager: Starting: Intent { 
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] 
cmp=com.foobar.hello/.StockActivity }
[2012-01-08 15:25:27 - ComNet] ActivityManager: 
java.lang.SecurityException: Permission Denial: starting Intent { 
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] 
flg=0x1000 cmp=com.foobar.hello/.StockActivity } from null 
(pid=9825, uid=2000) requires null


Not sure what I need to do to get rid of it...




  @Override
  public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//...
gotAccount(false);
  }

  static final int DIALOG_ACCOUNTS = 0;

  @Override
  protected Dialog onCreateDialog(int id) {
switch (id) {
  case DIALOG_ACCOUNTS:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Select a Google account");
final AccountManager manager = AccountManager.get(this);
final Account[] accounts = 
manager.getAccountsByType("com.google");

final int size = accounts.length;
String[] names = new String[size];
for (int i = 0; i < size; i++) {
  names[i] = accounts[i].name;
}
builder.setItems(names, new DialogInterface.OnClickListener() {
  public void onClick(DialogInterface dialog, int which) {
gotAccount(manager, accounts[which]);
  }
});
return builder.create();
}
return null;
  }

  static String PREF = "pref";

  private void gotAccount(boolean tokenExpired) {
SharedPreferences settings = getSharedPreferences(PREF, 0);
String accountName = settings.getString("accountName", null);
if (accountName != null) {
  AccountManager manager = AccountManager.get(this);
  Account[] accounts = manager.getAccountsByType("com.google");
  int size = accounts.length;
  for (int i = 0; i < size; i++) {
Account account = accounts[i];
if (accountName.equals(account.name )) {
  if (tokenExpired) {
manager.invalidateAuthToken("com.google", this.authToken);
  }
  gotAccount(manager, account);
  return;
}
  }
}
showDialog(DIALOG_ACCOUNTS);
  }

  private String AUTH_TOKEN_TYPE = "ah";

  private void gotAccount(final AccountManager manager, final Account 
account) {

SharedPreferences settings = getSharedPreferences(PREF, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("accountName", account.name );
editor.commit();
new Thread() {

  @Override
  public void run() {
try {
  final Bundle bundle =
  manager.getAuthToken(account, AUTH_TOKEN_TYPE, true, 
null, null)

  .getResult();
  runOnUiThread(new Runnable() {

public void run() {
  try {
if (bundle.containsKey(AccountManager.KEY_INTENT)) {
  Intent intent =
  bundle.getParcelable(AccountManager.KEY_INTENT);
  int flags = intent.getFlags();
  flags &= ~Intent.FLAG_ACTIVITY_NEW_TASK;
  intent.setFlags(flags);
  startActivityForResult(intent, REQUEST_AUTHENTICA

Re: [android-developers] Google App Engine and Users API and android

2012-01-08 Thread John Goche
On Sun, Jan 8, 2012 at 3:20 PM, Nikolay Elenkov
wrote:

> On Sun, Jan 8, 2012 at 9:24 PM, John Goche 
> wrote:
> >
> > Hello,
> >
> > I am still trying to authenticate to app engine using  google accounts
> > and would like to figure out the details of how such authenticator works.
> > How do I detect in my servlet that the user has authenticated with
> > google accounts?
>
> Read the App Engine documentation first. Then start searching for
> random examples.
>

Hi, the relevant App Engine documentation on the server side seems to be
this one
for the Users service (nothing specific to android on the client side here):

http://code.google.com/appengine/docs/java/gettingstarted/usingusers.html

As I mentioned there is this site also from google:

http://code.google.com/p/google-api-java-client/wiki/AndroidAccountManager

I tried running the code with some modifications as follows but I get the
following
error message when I try to run the code on a device (on the emulator it
works
but there are no accounts):

[2012-01-08 15:25:26 - ComNet] Starting activity
com.foobar.hello.StockActivity on device 80A358189040054719
[2012-01-08 15:25:27 - ComNet] ActivityManager: Starting: Intent {
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
cmp=com.foobar.hello/.StockActivity }
[2012-01-08 15:25:27 - ComNet] ActivityManager:
java.lang.SecurityException: Permission Denial: starting Intent {
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
flg=0x1000 cmp=com.foobar.hello/.StockActivity } from null (pid=9825,
uid=2000) requires null

Not sure what I need to do to get rid of it...

  
  

  @Override
  public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//...
gotAccount(false);
  }

  static final int DIALOG_ACCOUNTS = 0;

  @Override
  protected Dialog onCreateDialog(int id) {
switch (id) {
  case DIALOG_ACCOUNTS:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Select a Google account");
final AccountManager manager = AccountManager.get(this);
final Account[] accounts = manager.getAccountsByType("com.google");
final int size = accounts.length;
String[] names = new String[size];
for (int i = 0; i < size; i++) {
  names[i] = accounts[i].name;
}
builder.setItems(names, new DialogInterface.OnClickListener() {
  public void onClick(DialogInterface dialog, int which) {
gotAccount(manager, accounts[which]);
  }
});
return builder.create();
}
return null;
  }

  static String PREF = "pref";

  private void gotAccount(boolean tokenExpired) {
SharedPreferences settings = getSharedPreferences(PREF, 0);
String accountName = settings.getString("accountName", null);
if (accountName != null) {
  AccountManager manager = AccountManager.get(this);
  Account[] accounts = manager.getAccountsByType("com.google");
  int size = accounts.length;
  for (int i = 0; i < size; i++) {
Account account = accounts[i];
if (accountName.equals(account.name)) {
  if (tokenExpired) {
manager.invalidateAuthToken("com.google", this.authToken);
  }
  gotAccount(manager, account);
  return;
}
  }
}
showDialog(DIALOG_ACCOUNTS);
  }

  private String AUTH_TOKEN_TYPE = "ah";

  private void gotAccount(final AccountManager manager, final Account
account) {
SharedPreferences settings = getSharedPreferences(PREF, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("accountName", account.name);
editor.commit();
new Thread() {

  @Override
  public void run() {
try {
  final Bundle bundle =
  manager.getAuthToken(account, AUTH_TOKEN_TYPE, true, null,
null)
  .getResult();
  runOnUiThread(new Runnable() {

public void run() {
  try {
if (bundle.containsKey(AccountManager.KEY_INTENT)) {
  Intent intent =
  bundle.getParcelable(AccountManager.KEY_INTENT);
  int flags = intent.getFlags();
  flags &= ~Intent.FLAG_ACTIVITY_NEW_TASK;
  intent.setFlags(flags);
  startActivityForResult(intent, REQUEST_AUTHENTICATE);
} else if
(bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) {
  authenticatedClientLogin(
  bundle.getString(AccountManager.KEY_AUTHTOKEN));
}
  } catch (Exception e) {
handleException(e);
  }
}
  });
} catch (Exception e) {
  handleException(e);
}
  }
}.start();
  }

  static final int REQUEST_AUTHENTICATE = 0;

  @Override
  protected void onActivityResult(
  int requestCode, int resultCode, Intent data

Re: [android-developers] Google App Engine and Users API and android

2012-01-08 Thread Nikolay Elenkov
On Sun, Jan 8, 2012 at 9:24 PM, John Goche  wrote:
>
> Hello,
>
> I am still trying to authenticate to app engine using  google accounts
> and would like to figure out the details of how such authenticator works.
> How do I detect in my servlet that the user has authenticated with
> google accounts?

Read the App Engine documentation first. Then start searching for
random examples.

> Here is an example that uses "ah" as the string parameter to getAuthToken.
> Is this what I use?
>

Yes, "ah" is for App Engine. If you are not sure, just try it out.
If it works, you know it works :)

> Any help sincerely appreciated, I'm really stuck on this one.

Here's a small library and an associated blog post by none other
than Google's Tim Bray. If you can't make that work, go back a
few steps and read the docs a couple of more times. If that doesn't
make sense, go a few steps back and read about HTTP and OAuth.

http://www.tbray.org/ongoing/When/201x/2011/09/29/AERC

http://code.google.com/p/aerc/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Google App Engine and Users API and android

2012-01-08 Thread John Goche
Hello,

I am still trying to authenticate to app engine using  google accounts
and would like to figure out the details of how such authenticator works.
How do I detect in my servlet that the user has authenticated with
google accounts?

First of all there is the following link to the AccountManager API:

http://developer.android.com/reference/android/accounts/AccountManager.html

This code for picasa web seems to be one of the
few instances of sample code available:

http://code.google.com/p/google-api-java-client/wiki/AndroidAccountManager

So I need to figure out the ins and outs of the
google accounts authenticator and how to integrate it with android.

I found these links:

http://stackoverflow.com/questions/7587891/list-google-apps-accounts (this
is one of many links that shows how to access the account manager accounts,
the easy part)

http://code.google.com/apis/accounts/docs/OpenID.html (I think this is
something else)
http://stackoverflow.com/questions/7961686/which-authentication-method-is-better-for-dealing-with-google-api-and-google-acc(using
accounts manager seems to be the better choice)

http://stackoverflow.com/questions/3492775/is-there-an-official-way-to-authenticate-for-google-data-api-on-android-using-ac

I must admit I am having some trouble adapting the sample code to my case.
In particular I don't know what to pass as the
second argument for the string to getAuthToekn().

http://developer.android.com/reference/android/accounts/AccountManager.html#getAuthToken%28android.accounts.Account,%20java.lang.String,%20boolean,%20android.accounts.AccountManagerCallback%3Candroid.os.Bundle%3E,%20android.os.Handler%29

Apparently OAuth is used for authentication...

http://stackoverflow.com/questions/7699149/how-is-the-user-authentication-with-google-accounts-working-inside-the-gae-techn

http://stackoverflow.com/questions/3067780/google-auth-using-token

Here is an example that uses "ah" as the string parameter to getAuthToken.
Is this what I use?

http://stackoverflow.com/questions/6283096/android-getauthtoken-returning-null-dont-know-why

Any help sincerely appreciated, I'm really stuck on this one.

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-07 Thread John Goche
Hi Nikolay,

On Sat, Jan 7, 2012 at 5:39 PM, Nikolay Elenkov
wrote:

> On Sun, Jan 8, 2012 at 1:32 AM, John Goche 
> wrote:
>
> >
> > Now that you have mentioned AccountManager I have found the following
> site:
> >
> > http://gnuc.in/resources/archives/1404
> >
> > I don't know much of what this token is or what it is for.
>
> You should read up on it.
>

Where???


>
> > At the moment I
> > am not
> > authenticating users which is a big problem. I appreciate any more
> pointers.
> > BTW, if I wanted to use OpenID instead of Google accounts would there be
> > much to change?
>
> Why do you think OpenID is better for your case? Google accounts
> auth works OTB, you'll need to do more work for OpenID.
>

OK so maybe scrap OpenID. I will simply use Google accounts.
The bad part about google is that I've heared its servers are slow
in China, but then probably so would app engine.

To get pointers, you need to give more details: what are
> you trying to do? Why? How many users? etc.
>

Well, what I need to do is the following. A user connects to appspot.com
site and authenticates. The user then creates a "group". The user is the
admin for that group. The user can add other users to the group by
simply entering their email addresses. These can then connect and
join the group by entering their credentials. Once connected users
of a group may share information.

This is what I am trying to do.

Pointers welcome,

Regards,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-07 Thread Nikolay Elenkov
On Sun, Jan 8, 2012 at 1:32 AM, John Goche  wrote:

>
> Now that you have mentioned AccountManager I have found the following site:
>
> http://gnuc.in/resources/archives/1404
>
> I don't know much of what this token is or what it is for.

You should read up on it.

> At the moment I
> am not
> authenticating users which is a big problem. I appreciate any more pointers.
> BTW, if I wanted to use OpenID instead of Google accounts would there be
> much to change?

Why do you think OpenID is better for your case? Google accounts
auth works OTB, you'll need to do more work for OpenID.

To get pointers, you need to give more details: what are
you trying to do? Why? How many users? etc.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Google App Engine and Users API and android

2012-01-07 Thread John Goche
On Sat, Jan 7, 2012 at 5:14 PM, Nikolay Elenkov
wrote:

> On Sun, Jan 8, 2012 at 1:08 AM, John Goche 
> wrote:
>
> > I am using google App Engine. I need my users to authenticate
> > prior to being able to access the JDO objects on my servlet. Once
> > authenticated I need to match their usernames with fields in my
> > JDO POJOs to see whether they can perform certain operations
> > or not. How can I achieve this? I'm somewhat lost because all
> > the examples I am finding are not android specific.
> >
>
> There is not much Android-specific about this. If you are using
> Google accounts for authentication, you can use the AccountManager
> on Android to get an access token (there are examples on how to this).
> If not, there is nothing Android specific -- just have them send the
> username and password, token, etc. over SSL, authenticate, do your
> thing on the server side.
>
> So, how are you authenticating users?
>

Hi Nikolay,

Now that you have mentioned AccountManager I have found the following site:

http://gnuc.in/resources/archives/1404

I don't know much of what this token is or what it is for. At the moment I
am not
authenticating users which is a big problem. I appreciate any more pointers.
BTW, if I wanted to use OpenID instead of Google accounts would there be
much to change?

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google App Engine and Users API and android

2012-01-07 Thread Nikolay Elenkov
On Sun, Jan 8, 2012 at 1:08 AM, John Goche  wrote:

> I am using google App Engine. I need my users to authenticate
> prior to being able to access the JDO objects on my servlet. Once
> authenticated I need to match their usernames with fields in my
> JDO POJOs to see whether they can perform certain operations
> or not. How can I achieve this? I'm somewhat lost because all
> the examples I am finding are not android specific.
>

There is not much Android-specific about this. If you are using
Google accounts for authentication, you can use the AccountManager
on Android to get an access token (there are examples on how to this).
If not, there is nothing Android specific -- just have them send the
username and password, token, etc. over SSL, authenticate, do your
thing on the server side.

So, how are you authenticating users?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Google App Engine and Users API and android

2012-01-07 Thread John Goche
Hello,

I am using google App Engine. I need my users to authenticate
prior to being able to access the JDO objects on my servlet. Once
authenticated I need to match their usernames with fields in my
JDO POJOs to see whether they can perform certain operations
or not. How can I achieve this? I'm somewhat lost because all
the examples I am finding are not android specific.

Thanks,

John Goche

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en