Is Blackberry User-Agent only sent via browser? - blackberry

I would like to ask wheter the User-Agent property in the HTTP request header only sent via browser?
When I send a http/https request from a blackberry application, it seems there is no user-agent contains in the http header.
Thanks very much!
Also, if it is not possible to get the user agent from the request, are we able to get the user agent from Blackberry device?
Thanks!

No, User-Agent is not sent automatically if you use javax.microedition.io.HttpConnection from within your application.
Instead, use
HttpConnection con = (HttpConnection)Connector.open(myURL,
Connector.READ_WRITE, true);
con.setRequestProperty(HttpProtocolConstants.HEADER_USER_AGENT,
"MyBlackberryApplication/1.0");
...
If you need information about the device to send along the agent string, all of it (OS version, device etc.) is accessible via BlackBerry API: look at this class: net.rim.device.api.system.DeviceInfo

For unsigned j2me applications you can't set the user-agent and it will always be
UNTRUSTED/1.0
http://www.j2megame.org/j2meapi/JSR_271_Mobile_Information_Device_Profile_3_0/javax/microedition/io/package-summary.html
This behavior for the Unidentified
domain applications is specified in
the Mobile Service Architecture (JSR
248) specification

Yes, according to the Java document (javax.microedition.io
), it seems that user-agent is not automatically included unless you set it.
The application is responsible for
formatting and requesting that the
User-Agent field be included in HTTP
requests via the setRequestProperty
method in the interface
http://www.j2megame.org/j2meapi/JSR_271_Mobile_Information_Device_Profile_3_0/javax/microedition/io/package-summary.html

Turn the level from untrusted to maximum in WTK-Edit-Preference-Security-Security domain can be helpful to the "untrusted" user-agent problem in http requests.
For unsigned j2me applications you can't set the user-agent and it will always be UNTRUSTED/1.0

Related

Get the default app user agent for an iOS app

Many people have answered how to get the user-agent from a WebView, but I need the default user-agent that is normally sent in the http headers of an NSURLRequest. What is the best way to get that one?

Passbook couldn't connect to development web service

I'm creating my own Passbook Web Service, in order to register and update passes created by my server. When I add to the Pass information inside the pass.json the webServiceURL and the authenticationToken attributes, the pass is displayed but not added to the iOS Passbook App. Given I'm still in development I don't have a https with SSL server, but a plain http one:
http://192.168.1.100:8080/PassbookDelivery
Does the device and/or the protocol inside the Web Service need some special change in order to accept the pass produced by my server? Does the authenticationToken have any restriction, like string length, cipher or content?
NOTE: I already use the format URL for registering the device for updates, as detailed in the Passbook web service specification, which is (POST)
http://192.168.1.100:8080/PassbookDelivery/v1/devices/_deviceLibraryIdentifier_/registrations/_passTypeIdentifier_/_serialNumber_
but it doesn't get any call from the device.
Try this: go to Settings > Developer, scroll down to PASSKIT TESTING and toggle "Allow HTTP Services".

iOS: session + changing IP-addresses; how to handle it on the client?

in my iPhone/iPad-app I've got to deal with a server which determines sessions (not only, but also) according to the IP-address. The problem now is that with some providers, the phone's IP address changes after a few seconds and therefore the server can't recognize the session any more.
Is there any way to handle this on the client and "help" the server to stay unchanged without configuration changes? Or is it only possible serverside?
I'm not using a library (ASIHTTP-request, e.g.), but only NSURLConnection.
Nope, nothing you can do client side. You will have to configure the server to accept session ID only.

Network Connection Issue + Blackberry

I am facing a network connection issue. My client has sent me following mail and I am having no idea what I should do in this condition
"One of our companies have asked if it would be possible for them to use their apps with the data going via a proxy. The hve disabled WAP on their BES so they are unable to use the application. I think in this instance the data needs to be routed through the BIS."
For using BIS , I have read that application needs to be approved by RIM and we need to append a secret String provided by the RIM to the connection URL.
For BES we append ;deviceside=false in case of simulator.
For TCP we append ;deviceside=true to the connection URL.
For Wifiwe append ;interface=wifi to the connection URL.
What should we append in the case of BIS?

Facebook Connect for BlackBerry

I'm looking for a solution similar to the iPhone Facebook Connect (https://github.com/facebook/facebook-ios-sdk) for the BlackBerry platform. Basically, I need my users to authenticate against Facebook from within a native BlackBerry application (so, not a Web based mobile application). Is there a library I could use, and if not, what will be the correct approach to achieve this?
Thanks in advance!
Options for BlackBerry are:
Use Facebook Platform for Mobile
Use REST API approach provided by Eki Y. Baskoro
Try to port JavaFB from J2SE to J2ME
I managed to go through Facebook Connect authentication within my BB app. After cracking my head for three days I realised that it is the URL that is the culprit!
Basically these are what you need (assuming you are developing for 4.5 platform):
Using Browser Field, do a POST to http://m.facebook.com/login.php (the mobile version of Facebook) passing all the necessary arguments as per the Desktop application counterparts (one challenge is to get the signature generation correct).
Once the User successfully grants access, capture the URL of the success screen. You will obtain your auth_token.
Do a POST to the REST server to obtain the session key and secret given the auth_token you obtain.
Save the returned session key and secret, persist it, and wholla! your app is up and running.
I am developing a custom LoginScreen and FacebookFacade object to incorporate the first three steps above, if anyone is ever interested to reuse my code. It'll be GPLed, I suppose ;)
Afzal, I had a similar problem and I've found out that I actually had a problem with my connection string. You can look at the following link there is some explanation and code for creating the correct connection string
http://www.localytics.com/blog/post/how-to-reliably-establish-a-network-connection-on-any-blackberry-device/
and just add the connection string to the FetchThread where it opens the connection:
connection = (HttpConnection)Connector.open(absoluteUrl+getConnectionString());

Resources