Activity Popup plugin analog for Android

Hello everyone! I need your help :slight_smile:

I create an app for iOS / Android. In the application, I need to implement the Share function (for example, sending text and links to the application via the available communication channels - e-mail, messages, telegrams, etc.). For iOS, I use Activity Popup plugin and it works as it should. But with Android there was a problem. I absolutely can not figure out how to implement such a function.

I tried to use native.showPopup () - it did not help.

I also tried to use system.openURL (“mailto: subject = ‘Test’ & body = ‘Text’”) - this is closer, but does not work for WhatsApp.

Please help me understand this task.

Thank you!

There is an option to native.showPopup() called “social”.  See: https://docs.coronalabs.com/plugin/CoronaProvider_native_popup_social/index.html

Rob

Rob, hello and thank you for your reply!

I have tried this option and it does not work.

Here is my code:

[lua]

if (native.canShowPopup(“social”, “share”) == true) then

native.showPopup(“social”, 

{

        message = “Test share message”,

        listener = listener,

})

else

    native.showAlert(“Share error”, “Cannot send share message”, { “OK” } )

end

[/lua]

native.canShowPopup(“social”, “share”) always return False.

For test I use real device (Huawei SLA-L22, Android 7.0).

I don’t have any accounts (like Facebook, VK, etc.) on this phone.

Only WhatsApp and Telegram installed.

Humor me and leave off the 2nd parameter to the canShowPopup() call.

Rob

I removed "share"parameter from canShowPopup(). Same issue. Return false.

[lua]

if (native.canShowPopup(“social”) == true) then

native.showPopup(“social”, 

{

        message = “Test share message”,

        listener = listener,

})

else

    native.showAlert(“Share error”, “Cannot send share message”, { “OK” } )

end

[/lua]

I think the problem is that this plugin (or option “social”) works only with social networks (“twitter”, “facebook”, or “sinaWeibo”). And it returns False because none of them are installed on my device (no social networks accounts).

When I implement Activity Popup plugin for iOS it does not matter if I have any social networks accounts on my device.

I have the opportunity to try to send a message through any available service (the installed application), regardless of whether the account of this service is configured. Authorization in a specific service will be requested when opening the corresponding application.

The social plugin should still give you email and sms options even if no social media options are installed. The twitter, facebook and sinaWeibo options are for older versions of iOS pre-activity plugin.  Maybe just try calling it without trying to check canShowPopup().

Rob

I tried. When I call this code - nothing happens.

[lua]

native.showPopup(“social”, 

{

        message = “Test share message”,

        listener = listener,

})

[/lua]

May be there are some specific project settings?

Or I have to “install” or “add” this plugin to my project?

Do you have it included in your build.settings?

https://docs.coronalabs.com/plugin/CoronaProvider_native_popup_social/index.html

Rob

Rob, thank you for your help.

I didn’t include it in build.settings. But! The problem was in Ad-block plugin for Safari browser on my Mac.

When I open this link (https://docs.coronalabs.com/plugin/CoronaProvider_native_popup_social/index.html) with Ad-block enabled - I don’t see any info on the page, just left-side menu with overview and functions. Project settings page was nil. When I disabled Ad-block - page opened as it should.

Well… I have nothing to say… Its so… weird. I spent 3 days trying to solve this problem. Thank You Very Much!! :)))

Glad you got it working.

Rob

There is an option to native.showPopup() called “social”.  See: https://docs.coronalabs.com/plugin/CoronaProvider_native_popup_social/index.html

Rob

Rob, hello and thank you for your reply!

I have tried this option and it does not work.

Here is my code:

[lua]

if (native.canShowPopup(“social”, “share”) == true) then

native.showPopup(“social”, 

{

        message = “Test share message”,

        listener = listener,

})

else

    native.showAlert(“Share error”, “Cannot send share message”, { “OK” } )

end

[/lua]

native.canShowPopup(“social”, “share”) always return False.

For test I use real device (Huawei SLA-L22, Android 7.0).

I don’t have any accounts (like Facebook, VK, etc.) on this phone.

Only WhatsApp and Telegram installed.

Humor me and leave off the 2nd parameter to the canShowPopup() call.

Rob

I removed "share"parameter from canShowPopup(). Same issue. Return false.

[lua]

if (native.canShowPopup(“social”) == true) then

native.showPopup(“social”, 

{

        message = “Test share message”,

        listener = listener,

})

else

    native.showAlert(“Share error”, “Cannot send share message”, { “OK” } )

end

[/lua]

I think the problem is that this plugin (or option “social”) works only with social networks (“twitter”, “facebook”, or “sinaWeibo”). And it returns False because none of them are installed on my device (no social networks accounts).

When I implement Activity Popup plugin for iOS it does not matter if I have any social networks accounts on my device.

I have the opportunity to try to send a message through any available service (the installed application), regardless of whether the account of this service is configured. Authorization in a specific service will be requested when opening the corresponding application.

The social plugin should still give you email and sms options even if no social media options are installed. The twitter, facebook and sinaWeibo options are for older versions of iOS pre-activity plugin.  Maybe just try calling it without trying to check canShowPopup().

Rob

I tried. When I call this code - nothing happens.

[lua]

native.showPopup(“social”, 

{

        message = “Test share message”,

        listener = listener,

})

[/lua]

May be there are some specific project settings?

Or I have to “install” or “add” this plugin to my project?