Permalink
Browse files

add latest sdk and remove the FB jar

social integration should go in demos, FB isn't really meant to be packaged as a jar anyway
  • Loading branch information...
1 parent 8612103 commit 443d55f942a602d85d6e407101c87d32526d37b1 @drapp drapp committed Feb 14, 2013
View
@@ -3,12 +3,11 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
- <classpathentry exported="true" kind="lib" path="assets/android-facebook-3.0.jar"/>
<classpathentry exported="true" kind="lib" path="assets/scribe-1.3.2.jar"/>
<classpathentry exported="true" kind="lib" path="assets/signpost-commonshttp4-1.2.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="assets/signpost-core-1.2.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="assets/gson-2.1.jar"/>
- <classpathentry exported="true" kind="lib" path="assets/stackmob-java-client-sdk-1.1.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="assets/stackmob-java-client-sdk-1.1.2.jar"/>
<classpathentry exported="true" kind="lib" path="assets/inneractiveAdSDK-v3.1.9-S.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
View
@@ -28,6 +28,8 @@
<activity android:name=".activity.FacebookActivity"
android:configChanges="keyboardHidden|orientation"/>
+
+ <activity android:name="com.gigya.socialize.android.GSWebViewActivity" />
</application>
Binary file not shown.
@@ -1,85 +0,0 @@
-/**
- * Copyright 2011 StackMob
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.stackmob.android.sdk.activity;
-
-import com.facebook.android.DialogError;
-import com.facebook.android.Facebook;
-import com.facebook.android.Facebook.DialogListener;
-import com.facebook.android.FacebookError;
-import com.stackmob.sdk.exception.StackMobException;
-
-import static com.stackmob.android.sdk.common.StackMobAndroid.*;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-
-public class FacebookActivity extends Activity {
- public static final int RESULT_ERROR = 0;
- public static final int RESULT_OK = 1;
-
- private Facebook facebook;
-
- private void setFacebookToken(String accessToken, long accessTokenExpiry, Throwable e) {
- if(FacebookCallback != null) {
- if(e != null) {
- FacebookCallback.failure(new StackMobException(e.getMessage()));
- }
- else {
- FacebookCallback.success(accessToken, accessTokenExpiry);
- }
- }
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- facebook = new Facebook(FACEBOOK_APP_ID);
- facebook.authorize(this, new DialogListener() {
- @Override
- public void onComplete(Bundle values) {
- setFacebookToken(facebook.getAccessToken(), facebook.getAccessExpires(), null);
- finish();
- }
-
- @Override
- public void onFacebookError(FacebookError error) {
- setFacebookToken(null, 0, error);
- finish();
- }
-
- @Override
- public void onError(DialogError e) {
- setFacebookToken(null, 0, e);
- finish();
- }
-
- @Override
- public void onCancel() {
- setFacebookToken(null, 0, new Exception("Cancelled"));
- finish();
- }
- });
- }
-
- @Override
- public void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- facebook.authorizeCallback(requestCode, resultCode, data);
- }
-}
@@ -1,140 +0,0 @@
-/**
- * Copyright 2011 StackMob
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.stackmob.android.sdk.activity;
-
-import com.stackmob.sdk.exception.StackMobException;
-import static com.stackmob.android.sdk.common.StackMobAndroid.*;
-
-import oauth.signpost.OAuth;
-import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer;
-import oauth.signpost.commonshttp.CommonsHttpOAuthProvider;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.util.Log;
-
-public class TwitterActivity extends Activity {
- private static final String TAG = TwitterActivity.class.getCanonicalName();
-
- private static final String REQUEST_URL = "https://api.twitter.com/oauth/request_token";
- private static final String ACCESS_URL = "https://api.twitter.com/oauth/access_token";
- private static final String AUTHORIZE_URL = "https://api.twitter.com/oauth/authorize";
-
- private static final String OAUTH_CALLBACK_SCHEME = "x-oauthflow-twitter";
- private static final String OAUTH_CALLBACK_HOST = "callback";
- private static final String OAUTH_CALLBACK_URL = OAUTH_CALLBACK_SCHEME + "://" + OAUTH_CALLBACK_HOST;
-
- public static final int RESULT_ERROR = 0;
- public static final int RESULT_OK = 1;
-
- private CommonsHttpOAuthConsumer consumer;
- private CommonsHttpOAuthProvider provider;
-
- private void setTwitterTokens(String token, String secret, Throwable failure) {
- if(TwitterCallback != null) {
- if(failure != null) {
- TwitterCallback.failure(new StackMobException(failure.getMessage()));
- }
-
- else {
- TwitterCallback.success(token, secret);
- }
- }
- }
-
- private class RetrieveAccessTokenTask extends AsyncTask<Uri, Void, Void> {
- @Override
- protected Void doInBackground(Uri... params) {
- final Uri uri = params[0];
- final String oauth_verifier = uri.getQueryParameter(OAuth.OAUTH_VERIFIER);
-
- try {
- provider.retrieveAccessToken(consumer, oauth_verifier);
- }
- catch (Exception e) {
- Log.e(TAG, "OAuth - Access Token Retrieval Error", e);
- setTwitterTokens(null, null, e);
- finish();
- }
- return null;
- }
-
- @Override
- protected void onPostExecute(Void result) {
- super.onPostExecute(result);
- setTwitterTokens(consumer.getToken(), consumer.getTokenSecret(), null);
- finish();
- }
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- try {
- consumer = new CommonsHttpOAuthConsumer(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET);
- provider = new CommonsHttpOAuthProvider(REQUEST_URL, ACCESS_URL, AUTHORIZE_URL);
- }
- catch (Exception e) {
- Log.e(TAG, "Error creating consumer / provider", e);
- setTwitterTokens(null, null, e);
- finish();
- return;
- }
-
- Log.i(TAG, "Starting task to retrieve request token.");
- new OAuthRequestTokenTask().execute();
- }
-
- private class OAuthRequestTokenTask extends AsyncTask<Void, Void, Void> {
- @Override
- protected Void doInBackground(Void... params) {
- try {
- Log.i(TAG, "Retrieving request token from Google servers");
- final String url = provider.retrieveRequestToken(consumer, OAUTH_CALLBACK_URL);
- Log.i(TAG, "Popping a browser with the authorize URL : " + url);
- Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url))
- .setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP
- | Intent.FLAG_ACTIVITY_NO_HISTORY
- | Intent.FLAG_FROM_BACKGROUND);
- startActivity(intent);
- }
- catch (Exception e) {
- setTwitterTokens(null, null, e);
- }
- finish();
- return null;
- }
- }
-
- @Override
- public void onNewIntent(Intent intent) {
- super.onNewIntent(intent);
- final Uri uri = intent.getData();
- Log.d(TAG, "Calling onNewIntent with scheme: " + uri.getScheme());
-
- if (uri != null && uri.getScheme().equals(OAUTH_CALLBACK_SCHEME)) {
- Log.i(TAG, "Callback received : " + uri);
- Log.i(TAG, "Retrieving Access Token");
- new RetrieveAccessTokenTask().execute(uri);
- }
- }
-}
@@ -1,27 +0,0 @@
-/**
- * Copyright 2011 StackMob
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.stackmob.android.sdk.callback;
-
-import com.stackmob.sdk.exception.StackMobException;
-
-public interface StackMobFacebookCallback {
-
- void success(String token, long accessExpires);
-
- void failure(StackMobException e);
-
-}
@@ -1,26 +0,0 @@
-/**
- * Copyright 2011 StackMob
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.stackmob.android.sdk.callback;
-
-import com.stackmob.sdk.exception.StackMobException;
-
-public interface StackMobTwitterCallback {
-
- void success(String token, String tokenSecret);
-
- void failure(StackMobException e);
-}
@@ -18,20 +18,12 @@
import android.content.Context;
-import com.stackmob.android.sdk.callback.*;
import com.stackmob.sdk.callback.StackMobRedirectedCallback;
import com.stackmob.sdk.push.StackMobPush;
import com.stackmob.sdk.api.StackMob;
import com.stackmob.sdk.api.StackMob.OAuthVersion;
public class StackMobAndroid {
- public static String TWITTER_CONSUMER_KEY = "YOUR_TWITTER_CONSUMER_KEY_HERE";
- public static String TWITTER_CONSUMER_SECRET = "YOUR_TWITTER_CONSUMER_SECRET_HERE";
-
- public static String FACEBOOK_APP_ID = "YOUR_FACEBOOK_APP_ID_HERE";
-
- public static StackMobTwitterCallback TwitterCallback = null;
- public static StackMobFacebookCallback FacebookCallback = null;
// Init with minimal information and the most basic defaults
public static void init(Context c, int apiVersionNumber, String apiKey) {

0 comments on commit 443d55f

Please sign in to comment.