trailman
Aspiring developer
Profile
Posts: 280
Reg: Dec 10, 2010
Sedona, az
6,550
01/02/13 12:18 PM (13 years ago)

Socialize Android Integration

So I'm trying to get socialize to work with Android now. I've followed the instructions here: file://localhost/Users/brucefraser/Downloads/Chrome%20Downloads/socialize-sdk-android-2.7.5/docs/user_guide/getting_started.html At step 3 in that tutorial I pasted this in the AndroidManifest.xml file: <activity android:name="com.socialize.ui.comment.CommentActivity" android:configChanges="orientation|keyboardHidden|screenSize"/> <activity android:name="com.socialize.ui.action.ActionDetailActivity"/> <activity android:name="com.socialize.ui.profile.ProfileActivity"/> <activity android:name="com.socialize.auth.facebook.FacebookActivity"/> <activity android:name="com.socialize.ui.SocializeLaunchActivity" android:noHistory="true"/> Then at Step 5 I pasted this in the BT_activity_base.java file: import android.app.Activity; import android.os.Bundle; import android.view.View; import com.socialize.ActionBarUtils; import com.socialize.Socialize; import com.socialize.entity.Entity; public class ActionBarSample extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Call Socialize in onCreate Socialize.onCreate(this, savedInstanceState); // Your entity key. May be passed as a Bundle parameter to your activity String entityKey = "http://www.getsocialize.com"; // Create an entity object including a name // The Entity object is Serializable, so you could also store the whole object in the Intent Entity entity = Entity.newInstance(entityKey, "Socialize"); // Wrap your existing view with the action bar. // your_layout refers to the resource ID of your current layout. View actionBarWrapped = ActionBarUtils.showActionBar(this, R.layout.actionbar, entity); // Now set the view for your activity to be the wrapped view. setContentView(actionBarWrapped); } @Override protected void onPause() { super.onPause(); // Call Socialize in onPause Socialize.onPause(this); } @Override protected void onResume() { super.onResume(); // Call Socialize in onResume Socialize.onResume(this); } @Override protected void onDestroy() { // Call Socialize in onDestroy before the activity is destroyed Socialize.onDestroy(this); super.onDestroy(); } } I've got errors for step 3 and Step 5 I posted screen shots here: https://dl.dropbox.com/u/5618927/manifesterrors.jpg https://dl.dropbox.com/u/5618927/ActivityBase1.jpg https://dl.dropbox.com/u/5618927/ActivityBase2.jpg Any ideas? Thanks, Bruce
 
trailman
Aspiring developer
Profile
Posts: 280
Reg: Dec 10, 2010
Sedona, az
6,550
like
01/02/13 12:25 PM (13 years ago)
Oops! I didn't paste all the code for Step 5 in but I still have errors. https://dl.dropbox.com/u/5618927/ActivityBase3.jpg Thanks!
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/02/13 01:37 PM (13 years ago)
Have you set the android api level to higher than api8? if so, the manifest should be changed to: android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> ActivityBase1.jpg and ActivityBase2.jpg are showing those warnings because you haven't yet integrated the socialize code into the java file. ActivityBase3.jpg is throwing errors because you've added the code verbatim (is that the right word?). The code is example code and should be integrated into the existing elements of the BT_activity_base.java file, so for example where the socialize code says: public class ActionBarSample extends Activity { Your actual code is: public class BT_activity_base extends Activity implements LocationListener{
 
trailman
Aspiring developer
Profile
Posts: 280
Reg: Dec 10, 2010
Sedona, az
6,550
like
01/02/13 02:16 PM (13 years ago)
Thank you! All that worked for the Activity_Base file but after trying to fix the manifest I still have the same error. Where do I paste in the fix you provided above? https://dl.dropbox.com/u/5618927/manifesterrors2.jpg
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/02/13 02:26 PM (13 years ago)
Sorry. Where you've got this in your first post: <activity android:name="com.socialize.ui.comment.CommentActivity" android:configChanges="orientation|keyboardHidden|screenSize"/> Change it to: <activity android:name="com.socialize.ui.comment.CommentActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> If you've changed the api level to, for example api level 13, this should fix it.
 
trailman
Aspiring developer
Profile
Posts: 280
Reg: Dec 10, 2010
Sedona, az
6,550
like
01/02/13 02:34 PM (13 years ago)
Same error... https://dl.dropbox.com/u/5618927/manifesterrors3.jpg Socialize wants this: <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" /> In the manifest. Do I need it? When I take out android:targetSdkVersion="16" I still get the same error.
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/02/13 02:51 PM (13 years ago)
Hmmm, it's showing the old error message with the new code. Save everything and do a Project > Clean if you haven't already. See if that helps. Yes, you need the uses-sdk... manifest entry.
 
trailman
Aspiring developer
Profile
Posts: 280
Reg: Dec 10, 2010
Sedona, az
6,550
like
01/02/13 02:53 PM (13 years ago)
Nope, same error...
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/02/13 02:56 PM (13 years ago)
And you've got the build target at api level 16? (Right click Project > Properties > Android > google api level 16 ticked?).
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/02/13 03:03 PM (13 years ago)
Got it! I can just see in https://dl.dropbox.com/u/5618927/manifesterrors2.jpg, you've got the project set to Google APIs (Android 2.2). Just do what I posted above and it should be ok.
 
trailman
Aspiring developer
Profile
Posts: 280
Reg: Dec 10, 2010
Sedona, az
6,550
like
01/02/13 03:32 PM (13 years ago)
made no difference
 
Paul Rogers
Android Fan
Profile
Posts: 2524
Reg: May 30, 2011
UK
35,740
like
01/02/13 03:37 PM (13 years ago)
odd... Would you mind sending your project over? paul9qr (at) btinternet (dot) com? That api change should have fixed it.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.