native.showPopup("twitter") not working in App example project

Twitter share popup was resolved by using the social plugin (twitter plugin no longer exists)

I did a native plugin for the modal share action with image, text and url (for Airdrop, MMS, Mail, Air print, Twitter, Facebook etc.) + Instagram sharing as a custom activity.

 

You can find it here: https://github.com/jcbnlsn/CoronaSharePlugin

 

This is only for Enterprise subscribers.

 

@CoronaLabs feel free to put it on your plugin server  :wink:

Twitter share pop-up directly shows the tweet dialog in iOS, but in android, it prompts an app selection dialog. Whys is it so?

My code is as below:

        

        function tweetCallback( event )

            if event.action == “sent” then

                alert = native.showAlert(“Thanks”, “Thanks for tweeting”, { “OK”}, onAlert);

        

                if returnToView then

                    Proxy:sendNotification(AppCommands.CHANGE_SCREEN, returnToView);

                end

            end

        end

        

        local serviceName = “twitter”

        local popupName = “social”

        local isAvailable = native.canShowPopup( popupName, serviceName )

        – If it is possible to show the popup

        if isAvailable then

            – Show the popup

            native.showPopup( popupName,

            {

                service = serviceName, – The service key is ignored on Android.

                message = message,

                listener = tweetCallback,

                image = 

                {

                    { filename = picture, baseDir = system.ResourceDirectory },

                },

                url = 

                {

                    link,

                }

            })

        else

            – Popup isn’t available… Show error message

            native.showAlert( “Cannot send " … serviceName … " message.”, “Please setup your " … serviceName … " account or check your network connection.”, { “OK” } )

end

Please see the android and iOS screen-shots.

        B-COCF1CMAALQZ6.jpg B-CNLlWCIAAikUj.jpg

On Android, the plugin is implemented using the standard “Share” intent.  We’ve recently added the iOS equivalent using the “Activity” option (loads a UIActivityViewController).  I don’t know the history of the Android popup, the the ability to call Twitter and Facebook directly using the popup is an iOS6 and earlier concept where you would build a simple box with text buttons that would let you choose which to go with.  iOS 7, like Android’s preferred way is to give you a system dialog box of available sharing sites.

If you need to implement this directly, by passing the native dialogs, you can always code up Twitter directly.  There is a sample app that shows you how to do that in the CoronaSDK/SampleCode/Networking/Twitter folder.

Rob

when I implement this code into my project I get the error “please set up your twitter account or check your internet connection.” What is causing this error? My internet is fine and I’ve been able to inter app communicate with twitter for years with every other app

I report the same thing. Sharing doesn’t work with twitter and Facebook. But I work with Corona SDK, not enterprise.

Android and iOS handle social sharing differently, so Corona has modestly different APIs. Note this is not Corona’s fault. It’s due to the fact that Andy Rubin and Scott Forstall never sat down together over drinks with Mark Zuckerberg and Jack Dorsey years ago to figure out a consistent approach. :slight_smile:

On iOS, you have the choice of using native.showPopup()'s social plugin to share via Twitter and Facebook; there’s also the iOS sharing sheet, which Corona recently added as an alternative. (I’m ignoring for the moment the facebook.* library since it doesn’t sound like you want to do that.)

On Android, Facebook sharing via native.showPopup() is broken. There is a 2014 thread discussing this problem at length, but unfortunately we do not have an estimated fix date from Corona – despite my recent offer to bribe engineers by delivering extra-tasty baked goods to Corona HQ:

http://forums.coronalabs.com/topic/52755-can-corona-enable-limited-facebook-sharing-on-android-via-nativeshowpopup/

(Note I’m talking about Corona SDK, not Enterprise, above.)

Can I get some context on your issue?  Are you building for iOS or Android?  Can you provide a screen shot showing the error?  The native.showPopup(), regardless of the method uses existing OS logins for social networks an if you don’t have a twitter account on your device, the social sharing tools can’t use it.

Rob

Rob.

I build for iOS 8.1.2, 8.2, 6. 

I have twitter and facebooks accounts log in on my device, on all the devices I have.

There is no error - when I call native.canShowPopup() it returns false. And I can assure you - I have a twitter account on my device.

George

I am having the same issue. I am building for iOS 8.0 and added the libnative-popup-social.a framework into Xcode. But on device its still saying the services (Twitter, Facebook, and SinaWeibo) are all unavailable, even though I’m logged in in the device settings, and have the corresponding apps installed.

I think that problem is somehow connected to the issue with Apple servers. They still are mostly out of service.