Problem with Facebook URL in BlackBerry

I included Facebook in my application and tried to share some content. When I call FaceBookMain (), it shows an error, for example: “ Success WARNINNG SECURITY: Please process the URL above, like your password, and do not tell it to anyone. ” Sometimes this error occurs after logging into Facebook in a browser ( Webview), otherwise it appears immediately after clicking the sharing button.

The most important thing here, I do not encounter this problem in the simulator. Communication with Facebook works correctly in Simulator, but not on the device.

I add several class files with it:

Here is the FacebookMain.java class:

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) {} } 

This is the class of 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); } } 

If any authority has any hint or some more related code is required to receive it, please let me know.

+7
facebook blackberry blackberry-eclipse-plugin blackberry-jde blackberry-simulator
source share
1 answer

Do not use a secure connection. use http instead of https.

you can refer to here

the same problem is presented in https://stackoverflow.com/a/464616/167

facebook warning

0
source share

All Articles