Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Member protonsavy's Avatar
    Join Date
    Jul 2013
    Posts
    246
    Post Thanks / Like
    Mentioned
    11 Post(s)

    get socialize doubts

    any one using socialize's sdk? i want to upload a picture to fb using their sdk but i dont really know how to...anyone tried?

  2. #2
    Senior Member
    Join Date
    Mar 2012
    Posts
    945
    Post Thanks / Like
    Mentioned
    67 Post(s)
    Sure.... follow their docs on how to do it. Or this...

    Code:
    protected File getScreenshot(View view) {
        View v = view.getRootView();
        Boolean oldCacheSetting = v.isDrawingCacheEnabled();
        v.setDrawingCacheEnabled(true);
        Bitmap b = v.getDrawingCache();
        v.setDrawingCacheEnabled(oldCacheSetting);
        String extr = Environment.getExternalStorageDirectory().toString();
        File myPath = new File(extr, "screenshot.jpg");
        FileOutputStream fos = null;
        try {
                fos = new FileOutputStream(myPath);
                b.compress(Bitmap.CompressFormat.JPEG, 100, fos);
                fos.flush();
                fos.close();
                MediaStore.Images.Media.insertImage(getContentResolver(), b, "Screen", "screen");
        } catch (FileNotFoundException e) {
                e.printStackTrace();
        } catch (Exception e) {
                e.printStackTrace();
        }
        return myPath;
    }
    	
    public Uri getImageContentUri(File imageFile) {
        String filePath = imageFile.getAbsolutePath();
        Cursor cursor = this.getContentResolver().query(
        MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
        new String[] { MediaStore.Images.Media._ID },
        MediaStore.Images.Media.DATA + "=? ",
        new String[] { filePath }, null);
        if (cursor != null && cursor.moveToFirst()) {
                int id = cursor.getInt(cursor.getColumnIndex(MediaStore.MediaColumns._ID));
                Uri baseUri = Uri.parse("content://media/external/images/media");
                return Uri.withAppendedPath(baseUri, "" + id);
        } else {
                if (imageFile.exists()) {
                    ContentValues values = new ContentValues();
                    values.put(MediaStore.Images.Media.DATA, filePath);
                    return this.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
                } else {
                    return null;
                }
        }
    }
    	
    protected void postScreenshotToSocialize(View v) {
        	File myFile = getScreenshot(v);
        	final Uri image = getImageContentUri(myFile);
        	
        	final Entity entity = Entity.newInstance("Socialize Entity name here", null);
        	final Activity context = this;
        	
        	// First create a Socialize share object so we get the correct URLs
        	ShareOptions options = ShareUtils.getUserShareOptions(context);
        	
        	SocialNetwork[] where_to_share = {SocialNetwork.FACEBOOK };
    
        	ShareUtils.registerShare(context, entity, options, new ShareAddListener() {
        		@Override
        		public void onError(SocializeException error) {
        		}
        		
        		@Override
        		public void onCreate(Share result) {
        			// We have the result, use the URLs to add to the post
        			PropagationInfo propagationInfo = result.getPropagationInfoResponse().getPropagationInfo(ShareType.FACEBOOK);
        			String link = propagationInfo.getEntityUrl();
    
        			// Now post to Facebook.
        			Map<String, Object> postData = new HashMap<String, Object>();
        			
        			try {
        				
        				// Format the picture for Facebook
        				byte[] imageData = FacebookUtils.getImageForPost(context, image);
        				
        				// Add the photo to the post
        				postData.put("photo", imageData);
        				
        				PrefsCacheManager sharedPrefs = PrefsCacheManager.getInstance();
        				String msg = "Share message users see";
        				
        				// Add the link returned from Socialize to use SmartDownloads
        				postData.put("caption", msg + link);
        				
        				// Add other fields to postData as necessary
        				
        				// Post to me/photos
        				FacebookUtils.post(context, "me/photos", postData, new SocialNetworkPostListener() {
        					@Override
        					public void onNetworkError(Activity parent, SocialNetwork network, Exception error) {
    							if (parent != null) {
    								if (!parent.isFinishing()) {
    									Activity_BaseClass p = (Activity_BaseClass)parent;
    	    							p.displayMessageDialog("Failure", "Facebook servers did not respond.");
    								}
    							}
        					}
        					@Override
        					public void onCancel() { }
    						@Override
    						public void onAfterPost(Activity parent, SocialNetwork socialNetwork, JSONObject responseObject) {
    							if (parent != null) {
    								if (!parent.isFinishing()) {
    									Activity_BaseClass p = (Activity_BaseClass)parent;
    									p.displayMessageDialog("Success", "Picture posted to Facebook!");
    								}
    							}
    						}
        				});			
        			}
        			catch (Exception e) {
        				displayMessageDialog("Failure", "Internal error in 3rd party code.  This will be fixed in an update.\n\nYour screenshot was saved to your Gallery as the file 'screenshot.jpg'");
        			}
        		}
        	}, where_to_share);
        	
        }
    Be warned... there is a bug in Facebook's SDK. If you post a message, and while the message is being posted, the current activity closes.... the FB SDK will crash your app with a nullptr, since it does not check the Activity is still valid before calling the return callback.
    SVEN Studios Corp
    WordHero - realtime multiplayer 4x4 grid word game
    Anagram Hero - realtime multiplayer Anagram finding word game
    WordSearch Hero - realtime multiplayer Wordsearch word game
    Math Hero - realtime multiplayer Math game
    Avatar Hero - Create your own Avatar

  3. Thanks protonsavy thanked for this post
  4. #3
    Member protonsavy's Avatar
    Join Date
    Jul 2013
    Posts
    246
    Post Thanks / Like
    Mentioned
    11 Post(s)
    Thanks mind , i followed their docs to the word, the only place where i was(and still am) is the entity part , what should i enter in their dashboard and in my code. You've solved my code part , but im still confused with dashboard part

  5. #4
    Senior Member toxic's Avatar
    Join Date
    Aug 2013
    Posts
    893
    Post Thanks / Like
    Mentioned
    50 Post(s)
    an entity is like a unique id of your piece of content. could be unique id of an article or your picture

  6. Thanks protonsavy thanked for this post
  7. #5
    Member protonsavy's Avatar
    Join Date
    Jul 2013
    Posts
    246
    Post Thanks / Like
    Mentioned
    11 Post(s)
    thanks guys,a quick question, what do i need to put in my dashboard for the entity if im uploading an image through my phone , I use fb's sdk to upload images , but twitter4j sucks like anything , so this is the only way i can think of at the moment...

  8. #6
    Member protonsavy's Avatar
    Join Date
    Jul 2013
    Posts
    246
    Post Thanks / Like
    Mentioned
    11 Post(s)
    nevermind guys, with some random tinkering i've managed twitter and fb thanks for the help

  9. #7
    Senior Member
    Join Date
    Sep 2012
    Posts
    1,396
    Post Thanks / Like
    Mentioned
    66 Post(s)
    Did you find much improvement in downloads etc. with twitter/facebook integration ?

  10. #8
    Member
    Join Date
    Aug 2012
    Posts
    233
    Post Thanks / Like
    Mentioned
    13 Post(s)
    @adforandroidapps...
    Not really sure if the OP can answer, seems he just integrated it.

    Would be good to hear from @mind, about his experience.

  11. Thanks adforandroidapps thanked for this post
  12. #9
    Senior Member
    Join Date
    Mar 2012
    Posts
    945
    Post Thanks / Like
    Mentioned
    67 Post(s)
    @adforandroidapps : nope... I have not observed ANY increase in downloads or any virality as per their marketing spiel.

    This is why: Google uses links pointing back to the play.google.com/your_app_here address to determine how many people are interested in it. This is just ONE of the things used in calculating your app's rank in the lists. Socialize masks their URL's and does a redirect though their webservers. So Google only ever sees posts pointing to Socialize.... and NOT to your app.

    However, my Anagram Hero users use the 'leave a comment' functionality for realtime user support questions...

    Thoughts:
    ========
    Is it useless: no
    Did I integrate it correctly: I don't know
    Did it perform like their marketing guff says it would: no
    Did I have to get them to fix bugs before I could use it: yes
    Were they responsive and awesome to deal with: yes!
    Will I integrate it into WordHero: yes
    SVEN Studios Corp
    WordHero - realtime multiplayer 4x4 grid word game
    Anagram Hero - realtime multiplayer Anagram finding word game
    WordSearch Hero - realtime multiplayer Wordsearch word game
    Math Hero - realtime multiplayer Math game
    Avatar Hero - Create your own Avatar

  13. Likes adforandroidapps liked this post
    Thanks adforandroidapps thanked for this post
  14. #10
    Senior Member
    Join Date
    Sep 2012
    Posts
    1,396
    Post Thanks / Like
    Mentioned
    66 Post(s)
    Thanks for your comments on the Google Play ranking impact of the socializing aspect (i.e. back links to GP webpage etc.).

    However, original intent of my question was impact of socializing on "organic download" - i.e. real proliferation of user interest etc.

    For example as exemplified by Candy Crush game - where it's popularity (beyond just popular to phenomenally popular) by the social aspect (most prominently facebook) - where mostly non-tech type folks hear from all their friends about how they are playing it and then they also try to compete etc.

    A factor that may play there is a degree of critical mass - for "normal" apps (non-mainstream interest) the impact of social maybe some - but not huge. But if an app IS pretty famous to begin with, perhaps facebook may case a 10x improvement in that. That is, if an app is primed for virality, then maybe facebook can do wonders. For others maybe it has some incremental impact (of the type suggested by mind).

Similar Threads

  1. General Doubts and Multiple ADD Networks integration
    By gcc in forum Android Development
    Replies: 2
    Last Post: 2013-10-31, 04:51 AM
  2. New AdMob doubts
    By batalyaws in forum Advertising Networks
    Replies: 5
    Last Post: 2013-08-21, 06:21 PM
  3. Basic Doubts before developing/publishing Android app
    By gcc in forum Android Development
    Replies: 5
    Last Post: 2013-08-20, 11:50 AM
  4. LeadBolt integration doubts
    By Awennor in forum Android Development
    Replies: 3
    Last Post: 2012-01-24, 05:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •