facebook ब्लैकबेरी में फेसबुक में यूआरएल का मुद्दा



blackberry blackberry-simulator (1)

मैंने अपने ऐप में फेसबुक को एकीकृत किया है और कुछ सामग्री साझा करने की कोशिश कर रही हूं। जब मैं फेसबैक मेन () कॉल करता हूं, तो यह त्रुटि की तरह दिखाई देती है: " सफलता की सुरक्षा चेतावनी: कृपया उपरोक्त यूआरएल का इलाज करें जैसे आप अपना पासवर्ड लेंगे और किसी के साथ साझा न करें। " कभी-कभी यह त्रुटि ब्राउज़र में फेसबुक (वेबदृश्य) के साथ लॉगिन होने के बाद आती है अन्यथा यह शेयर बटन पर क्लिक करने के बाद आता है

सबसे महत्वपूर्ण बात यह है कि, मैं सिम्युलेटर में इस समस्या का सामना नहीं कर रहा हूं। फेसबुक के साथ शेयरिंग सिम्युलेटर में ठीक से काम कर रही है, लेकिन डिवाइस में नहीं।

मैं इसके साथ कुछ वर्ग फ़ाइलें जोड़ रहा हूं:

यहां FacebookMain.java वर्ग है:

import net.rim.device.api.applicationcontrol.ApplicationPermissions;
import net.rim.device.api.applicationcontrol.ApplicationPermissionsManager;
import net.rim.device.api.system.PersistentObject;
import net.rim.device.api.system.PersistentStore;
import net.rim.device.api.ui.UiApplication;

public class FacebookMain implements ActionListener{// extends MainScreen implements ActionListener {

    // Constants

    public final static String NEXT_URL = "http://www.facebook.com/connect/login_success.html";
    public final static String APPLICATION_ID = "406758776102494";//"533918076671162" ;
    private final static long persistentObjectId = 0x854d1b7fa43e3577L;

    static final String ACTION_ENTER = "updateStatus";
    static final String ACTION_SUCCESS = "statusUpdated";
    static final String ACTION_ERROR = "error";
    private ActionScreen actionScreen;

    private PersistentObject store;

    private LoginScreen loginScreen;
    private LogoutScreen logoutScreen;
    private HomeScreen homeScreen;
    private UpdateStatusScreen updateStatusScreen;
    private RecentUpdatesScreen recentUpdatesScreen;
    private UploadPhotoScreen uploadPhotoScreen;
    private FriendsListScreen friendsListScreen;
    private PokeFriendScreen pokeFriendScreen;
    private PostWallScreen postWallScreen;
    private SendMessageScreen sendMessageScreen;

    private String postMessage;

    private FacebookContext fbc;
    public static boolean isWallPosted=false;
    public static boolean isFacebookScreen = false;

    public FacebookMain(String postMessge) {
        this.postMessage= postMessge;
        isFacebookScreen = true;

        checkPermissions();

        fbc=new FacebookContext(NEXT_URL, APPLICATION_ID);
        loginScreen = new LoginScreen(fbc,"KingdomConnect: "+postMessge);
        loginScreen.addActionListener(this);
        UiApplication.getUiApplication().pushScreen(loginScreen);

    }

    private void init() {
        store = PersistentStore.getPersistentObject(persistentObjectId);
        synchronized (store) {
            if (store.getContents() == null) {
                store.setContents(new FacebookContext(NEXT_URL, APPLICATION_ID));
                store.commit();
            }
        }
        fbc = (FacebookContext) store.getContents();
    }

    private void checkPermissions() {

        ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
        ApplicationPermissions original = apm.getApplicationPermissions();

        if ((original.getPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION) == ApplicationPermissions.VALUE_ALLOW) && (original.getPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS) == ApplicationPermissions.VALUE_ALLOW) && (original.getPermission(ApplicationPermissions.PERMISSION_CROSS_APPLICATION_COMMUNICATION) == ApplicationPermissions.VALUE_ALLOW) && (original.getPermission(ApplicationPermissions.PERMISSION_INTERNET) == ApplicationPermissions.VALUE_ALLOW) && (original.getPermission(ApplicationPermissions.PERMISSION_SERVER_NETWORK) == ApplicationPermissions.VALUE_ALLOW) && (original.getPermission(ApplicationPermissions.PERMISSION_EMAIL) == ApplicationPermissions.VALUE_ALLOW)) {
            return;
        }

        /*ApplicationPermissions permRequest = new ApplicationPermissions();
        permRequest.addPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_CROSS_APPLICATION_COMMUNICATION);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_INTERNET);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_SERVER_NETWORK);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_EMAIL);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_INTERNET);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_AUTHENTICATOR_API);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_SERVER_NETWORK);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_WIFI);*/
        ApplicationPermissions permRequest = new ApplicationPermissions();
        permRequest.addPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_CROSS_APPLICATION_COMMUNICATION);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_INTERNET);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_SERVER_NETWORK);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_EMAIL);

        boolean acceptance = ApplicationPermissionsManager.getInstance().invokePermissionsRequest(permRequest);

        if (acceptance) {
            // User has accepted all of the permissions.
            return;
        } else {
        }
    }

    public void saveContext(FacebookContext pfbc) {
        synchronized (store) {
            store.setContents(pfbc);
            System.out.println(pfbc);
            store.commit();
        }
    }

    public void logoutAndExit() {
        saveContext(null);
        logoutScreen = new LogoutScreen(fbc);
        logoutScreen.addActionListener(this);
    }

    public void saveAndExit() {
        saveContext(fbc);
        exit();
    }

    private void exit() {
        AppenderFactory.close();
        System.exit(0);
    }

    public void onAction(Action event) {}
}

यह Facebook.java वर्ग है:

   public class Facebook {

        protected Logger log = Logger.getLogger(getClass());
        public static String API_URL = "https://graph.facebook.com";

        public Facebook() {
        }

        public static Object read(String path, String accessToken) throws FacebookException {
            return read(path, null, accessToken);
        }

        public static Object read(String path, Parameters params, String accessToken) throws FacebookException {
            Hashtable args = new Hashtable();
            args.put("access_token", accessToken);
            args.put("format", "JSON");

            if ((params != null) && (params.getCount() > 0)) {
                Enumeration paramNamesEnum = params.getParameterNames();

                while (paramNamesEnum.hasMoreElements()) {
                    String paramName = (String) paramNamesEnum.nextElement();
                    String paramValue = params.get(paramName).getValue();
                    args.put(paramName, paramValue);
                }
            }

            try {
                StringBuffer responseBuffer = HttpClient.getInstance().doGet(API_URL + '/' + path, args);

                if (responseBuffer.length() == 0) {
                    throw new Exception("Empty response");
                }

                return new JSONObject(new JSONTokener(responseBuffer.toString()));

            } catch (Throwable t) {
                t.printStackTrace();
                throw new FacebookException(t.getMessage());
            }
        }

        public static Object write(String path, Object object, String accessToken) throws FacebookException {
            Hashtable data = new Hashtable();
            data.put("access_token", accessToken);
            data.put("format", "JSON");

            try {
                JSONObject jsonObject = (JSONObject) object;
                Enumeration keysEnum = jsonObject.keys();

                while (keysEnum.hasMoreElements()) {
                    String key = (String) keysEnum.nextElement();
                    Object val = jsonObject.get(key);

                    if (!(val instanceof JSONObject)) {
                        data.put(key, val.toString());
                    }
                }

                StringBuffer responseBuffer = HttpClient.getInstance().doPost(API_URL + '/' + path, data);

                if (responseBuffer.length() == 0) {
                    throw new FacebookException("Empty response");
                }

                return new JSONObject(new JSONTokener(responseBuffer.toString()));
            } catch (Exception e) {
                throw new FacebookException(e.getMessage());
            }
        }

        public static Object delete(String path, String accessToken) throws FacebookException {
            Hashtable data = new Hashtable();
            data.put("access_token", accessToken);
            data.put("format", "JSON");
            data.put("method", "delete");

            try {
                StringBuffer responseBuffer = HttpClient.getInstance().doPost(API_URL + '/' + path, data);

                if (responseBuffer.length() == 0) {
                    throw new FacebookException("Empty response");
                }

                return new JSONObject(new JSONTokener(responseBuffer.toString()));
            } catch (Exception e) {
                throw new FacebookException(e.getMessage());
            }
        }

    }


And it is BrowserScreen.class:

public class BrowserScreen extends ActionScreen {

    //  int[] preferredTransportTypes = { TransportInfo.TRANSPORT_TCP_CELLULAR, TransportInfo.TRANSPORT_WAP2, TransportInfo.TRANSPORT_BIS_B };
    int[] preferredTransportTypes = TransportInfo.getAvailableTransportTypes();//{ TransportInfo.TRANSPORT_BIS_B };
    ConnectionFactory cf;
    BrowserFieldConfig bfc;
    BrowserField bf;
    String url;

    public BrowserScreen(String pUrl) {
        super();
        url = pUrl;

        cf = new ConnectionFactory();
        cf.setPreferredTransportTypes(preferredTransportTypes);

        bfc = new BrowserFieldConfig();
        bfc.setProperty(BrowserFieldConfig.ALLOW_CS_XHR, Boolean.TRUE);
        bfc.setProperty(BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE);
        bfc.setProperty(BrowserFieldConfig.USER_SCALABLE, Boolean.TRUE);
        bfc.setProperty(BrowserFieldConfig.MDS_TRANSCODING_ENABLED, Boolean.FALSE);
        bfc.setProperty(BrowserFieldConfig.NAVIGATION_MODE, BrowserFieldConfig.NAVIGATION_MODE_POINTER);
        bfc.setProperty(BrowserFieldConfig.VIEWPORT_WIDTH, new Integer(Display.getWidth()));
        //      bfc.setProperty(BrowserFieldConfig.CONNECTION_FACTORY, cf);

        bf = new BrowserField(bfc);

    }

    public void browse() {
        show();
        fetch();
    }

    public void show() {
        add(bf);
    }

    public void fetch() {
        bf.requestContent(url);
    }

    public void hide() {
        delete(bf);
    }

}

अगर किसी भी शरीर में कोई सुराग है या इसे पाने के लिए कुछ और संबंधित कोड चाहते हैं, तो कृपया मुझे बताएं


सुरक्षित कनेक्शन का उपयोग न करें https के बजाय http का उपयोग करें

आप यहां संदर्भित कर सकते हैं

वही समस्या में प्रस्तुत किया जाता है

फेसबुक चेतावनी





blackberry-jde