Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

post on facebook wall programmatically in blackberry 10

Hi All,
 
I am developing an appwhich contained following feature:
there will be an edit box ,a image file and an ok button.Whatever user types in editbox and fill the image field,when he clicks on ok button i need to post that text and image in facebook wall.. i dont have any clue to dothis. can u plz help to start up with this
 
Thanks in advance
Developer
Posts: 145
Registered: ‎12-23-2012
My Device: BB10 Dev Alpha
My Carrier: wifi

Re: post on facebook wall programmatically in blackberry 10

sometime back I wrote simple application in Qt that upload pic to facebook.

 

here is link for more details

 

http://kunalmaemo.blogspot.kr/2012/04/upload-photo-on-facebook-using-qt.html

Developer
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

Re: post on facebook wall programmatically in blackberry 10

Please give another post.I canot get any solution.

Developer
Posts: 145
Registered: ‎12-23-2012
My Device: BB10 Dev Alpha
My Carrier: wifi

Re: post on facebook wall programmatically in blackberry 10

Can you explain where you are facing problem ? Is it because of changed API or some other problem ?

Developer
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

Re: post on facebook wall programmatically in blackberry 10

void FacebookHelper::login( const QString& scope ){

    QUrl url("https://www.facebook.com/dialog/oauth");
    url.addQueryItem("client_id",mAppId);
    url.addQueryItem("redirect_uri",
        "https://www.facebook.com/connect/login_success.html");
    url.addQueryItem("response_type","token");
    url.addQueryItem("scope",scope);

    //view = new QWebView();

    view->load( url );
    view->show();
    connect(view,SIGNAL(loadFinished(bool)),this,SLOT(loginResponse(bool)));
}

void FacebookHelper::loginResponse( bool status ){
    QUrl url= view->url();
    QString strUrl = url.toString();

    int sIndex = strUrl.indexOf("access_token=");
    int eIndex = strUrl.indexOf("&expires_in");
    if( sIndex != -1 && eIndex != -1 ){
        mAccessToken= strUrl.mid(sIndex, eIndex - sIndex);
        mAccessToken = mAccessToken.remove("access_token=");
        emit authStatus( mAccessToken);
    }
}

 view->load(url);

 view->show();

 not in BB 10;

 

 

Demoapp
App ID:591224394222671
App Secret:9da4ad9fbe89e405fbbfff27c0c08024(reset)

 

Deauthorize Callback URL:

https://www.google.co.in/

 

Developer
Posts: 145
Registered: ‎12-23-2012
My Device: BB10 Dev Alpha
My Carrier: wifi

Re: post on facebook wall programmatically in blackberry 10

" view->load(url);
view->show();
not in BB 10;"

Your problem is still not clear to me, but it seems that web view is not showing up ?

My current code from Qt Application, does you application is Qt application or Cascades application, and is it C++ application or QML application ?.

Are you able to use QWebView in you application otherwise?
Developer
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

Re: post on facebook wall programmatically in blackberry 10

In QML, I saw web view but not in C++.

Please provide code for C++ for web view.

 

Developer
Posts: 145
Registered: ‎12-23-2012
My Device: BB10 Dev Alpha
My Carrier: wifi

Re: post on facebook wall programmatically in blackberry 10

Can you post you whole application some where ? It would be easy for me to understand the problem.
Developer
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

Re: post on facebook wall programmatically in blackberry 10

Hello kunal_one

 

    I have give you code and appid. please provide complete code for BB10 . We also give you to open my account using "reset" link. I can not run your code in BB10.

Thanks

Developer
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

Re: post on facebook wall programmatically in blackberry 10

[ Edited ]

Hello kunal_one

---------------------main.qml-------------------------------


import bb.cascades 1.0


Page {
    Container {
        ScrollView {
id: scrollView
scrollViewProperties {
    scrollMode: ScrollMode.Both
    pinchToZoomEnabled: true
}
layoutProperties: StackLayoutProperties { spaceQuota: 1.0 }
 
Container {
    background: Color.LightGray
 
    WebView {
        id: webView
       
 
        onMinContentScaleChanged: {
            scrollView.scrollViewProperties.minContentScale = minContentScale;
        }
 
        onMaxContentScaleChanged: {
            scrollView.scrollViewProperties.maxContentScale = maxContentScale;
        }
                    objectName: "webView"
                }
}
}
}
}


----------------------------Demoapp.cpp---------------------------
Demoapp::Demoapp(bb::cascades::Application *app)
: QObject(app)
{
    // create scene document from main.qml asset
    // set parent to created document to ensure it exists for the whole application lifetime
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

    // create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();
    qml->setContextProperty("app", this);
    QUrl url("https://www.facebook.com/dialog/oauth");
       url.addQueryItem("client_id","428471333837212");
       url.addQueryItem("redirect_uri","https://www.facebook.com/connect/login_success.html");
       url.addQueryItem("response_type","token");
       url.addQueryItem("scope","read_stream,publish_stream");
       view = root->findChild<WebView*>("webView");

       view->setUrl(url);
       view->reload();
       connect(view,SIGNAL(loadFinished(bool)),this,SLOT(loginResponse(bool)));


    // set created root object as a scene
    app->setScene(root);
}

void Demoapp::loginResponse( bool status ){
    QUrl url= view->url();
    QString strUrl = url.toString();

    int sIndex = strUrl.indexOf("access_token=");
    int eIndex = strUrl.indexOf("&expires_in");
    if( sIndex != -1 && eIndex != -1 ){
    QString    mAccessToken= strUrl.mid(sIndex, eIndex - sIndex);
        mAccessToken = mAccessToken.remove("access_token=");
        QTextStream out(stdout);
        	out << "ssssssssssssssssssssssssss\n";

        	out << mAccessToken;
      // emit authStatus( mAccessToken);


    }

 

The out put is 

 

Success 
SECURITY WARNING: Please treat the URL above as you would your password and do not share it with anyone.

 But I can not get mAccessToken.

Please help me.