Permalink
Browse files

Add information about configuring CLIENT_ID.

Add information in the README about CLIENT_ID
Add check in SignInActivity to see if the CLIENT_ID has been changed.
  • Loading branch information...
1 parent 01273ca commit 702e1df3353b4bd57ee55b4f7409370737baff6c Simon Krueger committed Apr 30, 2012
View
@@ -57,7 +57,14 @@ The Java Compiler must be version 1.6 or higher.
Visit: http://dev.live.com and click the "Documentation" link.
-4. Known issues:
+4. Sample project
+There is a sample project located in the sample directory. Using eclipse this project can be added
+using the File > Import > General > Existing Projects into Workspace wizard. Before the project can be
+properly used, the static variable com.microsoft.live.sample.Config.CLIENT_ID (see Config.java) must
+be changed to your own client ID. For help on obtaining a client ID, please see
+http://go.microsoft.com/fwlink/?LinkId=220871
+
+5. Known issues:
1) Login dialog is destroyed on screen rotation if the Activity is not set to
ignore orientation changes in AndroidManifest.xml.
@@ -5,7 +5,7 @@
package com.microsoft.live.sample;
final public class Config {
- public static final String CLIENT_ID = "YOUR_CLIENT_ID_HERE";
+ public static final String CLIENT_ID = "YOUR CLIENT ID HERE";
public static final String[] SCOPES = {
"wl.signin",
@@ -43,30 +43,43 @@ protected void onCreate(Bundle savedInstanceState) {
mBeginTextView = (TextView) findViewById(R.id.beginTextView);
mSignInButton = (Button) findViewById(R.id.signInButton);
- mSignInButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- mAuthClient.login(SignInActivity.this,
- Arrays.asList(Config.SCOPES),
- new LiveAuthListener() {
- @Override
- public void onAuthComplete(LiveStatus status,
- LiveConnectSession session,
- Object userState) {
- if (status == LiveStatus.CONNECTED) {
- launchMainActivity(session);
- } else {
- showToast("Login did not connect. Status is " + status + ".");
+
+ // Check to see if the CLIENT_ID has been changed.
+ if (Config.CLIENT_ID.equals("YOUR CLIENT ID HERE")) {
+ mSignInButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ showToast("In order to use the sample, you must first place your client id " +
+ "in com.microsoft.live.sample.Config.CLIENT_ID. For more " +
+ "information see http://go.microsoft.com/fwlink/?LinkId=220871");
+ }
+ });
+ } else {
+ mSignInButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mAuthClient.login(SignInActivity.this,
+ Arrays.asList(Config.SCOPES),
+ new LiveAuthListener() {
+ @Override
+ public void onAuthComplete(LiveStatus status,
+ LiveConnectSession session,
+ Object userState) {
+ if (status == LiveStatus.CONNECTED) {
+ launchMainActivity(session);
+ } else {
+ showToast("Login did not connect. Status is " + status + ".");
+ }
}
- }
-
- @Override
- public void onAuthError(LiveAuthException exception, Object userState) {
- showToast(exception.getMessage());
- }
- });
- }
- });
+
+ @Override
+ public void onAuthError(LiveAuthException exception, Object userState) {
+ showToast(exception.getMessage());
+ }
+ });
+ }
+ });
+ }
}
@Override

0 comments on commit 702e1df

Please sign in to comment.