Implementation of "Share to Facebook" in web view apps

Asked 2 years ago, Updated 2 years ago, 148 views

I am working on creating an app for the first time.

"We are trying to implement ""share to Facebook"" from the Android app using web view."
* It's a self-made button.Because I don't want to use the official button.

I was able to confirm that I could actually share it with you, but
"When I press ""Cancel"" or ""Post"" on the post screen, the screen turns white, and I can't go to the ""Share completion screen?""

"

* Press the Back button on the device to return to the Share screen on the Facebook side (even though the share has already been completed).
*All I have to do is forcefully shut down, but they won't come back to my app.

I will list the source of the corresponding part, so if anyone knows anything about it, I would appreciate it if you could give me some advice on what's wrong.

The build was done on Android Studio.

* Assumptions *

Source Code

<p><button class="midium blue" id="post_facebook">Publish to Facebook</button>> 

// Facebook Post Button Press 
$('#post_facebook').on('click', function(){ 
    US>FB.ui({ 
        method: 'share', 
        href —Specified link destination URL. 
    }, function(response){ 
        // It doesn't look like it's coming to processing here. 
    }); 
}

android android-studio facebook

2022-09-30 20:13

1 Answers

I don't know when I bind Click, and
I can't see the full picture, so I don't even know where FB is declared.
Is the WebView app a framework like Cordova?
Or are you just showing the Web pages that are included in the server or app in WebView?
There are many unclear points, so I will write down only the points that I am concerned about.

  • Is jQuery initialized correctly?
      You seem to be using jQuery, but is it initialized correctly?
      Is there anything like jQuery doesn't work when you bind clicks?
  • Have you reached the function of the click event?
      If the function is not activated, it will not be executed in the first place.
      Please check again to see if the binding is going well.
  • FB has been declared, and is there a function ui in the included object?
      Calling FB before it is initialized will not work without any contents.
      Make sure that FB has been initialized correctly when you click.
  • It seems that the callback has not been reached, but have you made the share itself?
      If you don't have the share itself, I don't know if FB is working correctly in the first place.
      Also, even if you can share it, if the contents are strange, the parameters will not be crossed, so you need to check the specifications.
      Other than that, how did you confirm that you reached the callback?

I hope this will be helpful.

Also, you seem to be using WebSDK, but
What's going on with the app?
The implementation method is still unclear.


2022-09-30 20:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.