Details of my phone:
Model:Blackberry Curve 8520
Version :5.0.0.1036
data services :on
When I am installing google maps I am able to see the location ,so there is a chance of obtaining the current location using this phone.
I am trying to develop an application which will show the current location of the phone,by using the cell site locations because this phone model does not have an in-built GPS device.
I am using the following code:
BlackBerryCriteria bc=new BlackBerryCriteria(GPSInfo. GPS_MODE_CELLSITE );
try {
LocationProvider lp=LocationProvider.getInstance(bc);
if(lp !=null)
{
Location loc=lp.getLocation(-1);
add (new EditField(loc.getQualifiedCoordinates().getLatitude()+"\n"+loc.getQualifiedCoordinates().getLongitude(),""));
}
else
{
add(new EditField("unable to find the location provider", ""));
}
} catch (LocationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}}
I am installing the alx file on the bb phone using desktop manager.
On starting the application it is giving me an Uncaught exception:
NET.RIM.DEVICE.API.SYSTEM.UNSupportedOperationException.
The device might currently not support GPS_MODE_CELLSITE. Check using
GPSInfo.isGPSModeAvailable(GPS_MODE_CELLSITE)
and use another mode if neccessary.
It might not support GPS_MODE_CELLSITE because:
There is no valid SIM card in your phone (ok, i assume you have one :)
Check if your device and carrier have available GPS mode you are using (here)
If your carrier is Verizone, check for Verizon GPSSettings signing requirement
Your APN settings are not correct (Options > Device > Advanced Settings > TCP IP)
You don't have a BlackBerry Service Plan (not too sure about that one)
Related
I would like to switch between two apps without loosing the previous state of the application. How can we achieve this using appium.
Scenario:
1. Launch any application which requires OTP to login ( Ex:filpkart)
2. Launch SMS application and read the OTP
3. Close SMS application and Switch back to first app and enter OTP which we read it from SMS application.
Could some one help me on this.
Regards,
Shiva Oleti
Well if you want to send an app in background then simply use driver.CloseApp() function and relaunch it by driver.OpenApp()
You can also use press keycode method Below are the codes
Home Menu Button - 82
Back Button - 4
Recent app - 187
and then perform the getOTP activity from message then switch back to main app
Step1:- Launch app normally passing all the desired capabilities(For e.g Flipkart app)
Step2):- perform action to get OTP
Step3):- Once OTP received try to pass th AppPacakge and AppActivity of the messaging app where you get otp to below method(you get app pacakage and activity by adb shell command)
public String startNewAndroidActivity(String AppPacakge, String AppActivity) throws
Exception{
String actvty = null;
Activity activity = new Activity(AppPacakge, AppActivity);
activity.setAppWaitPackage(AppPacakge);
activity.setAppWaitActivity(AppActivity);
activity.setStopApp(false);
try {
((AndroidDriver<MobileElement>) driver).startActivity(activity);
Thread.sleep(1000);
actvty = ((StartsActivity) driver).currentActivity();
System.out.println(actvty);
}
catch (Exception e) {
System.out.println("Error occured while starting new Activity
"+e.getMessage());
e.printStackTrace();
}
return actvty;
}
Step4). Once message(OTP) is read close the message application by below method.
public boolean closeApplication() throws Exception {
boolean flag = false;
if(driver!=null) {
driver.closeApp();
flag = true;
}
return flag;
}
Step5). Once this is close find the Xpath of the field where you need to copy the otp. Paste it and go ahead.
P.S:- This work well with Android app.
Updated
For that you need to define two AppiumServer with different port, two AppiumDriver (one for sms app and another for another app).
Start appium driver with 2 different port eg: 4723 and 4724. Define 2 drivers:
public static AppiumDriver<MobileElement> driver1;
public static AppiumDriver<MobileElement> smsDriver;
Define DesiredCapabilities for both app and initialize both driver.
First open and do Login.
public void startApp1(){
DesiredCapabilities cap1 = new DesiredCapabilities();
cap1.setCapability(MobileCapabilityType.NO_RESET, true);
cap1.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 600);
cap1.setCapability(MobileCapabilityType.DEVICE_NAME, "android device");
cap1.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
cap1.setCapability("appPackage", "your app1 package name");
cap1.setCapability("appActivity", "your app1 package name");
cap1.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2");
driver1 = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
}
After that start sms and perform the action
public void startApp2(){
DesiredCapabilities cap2 = new DesiredCapabilities();
cap2.setCapability(MobileCapabilityType.NO_RESET, true);
cap2.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 600);
cap2.setCapability(MobileCapabilityType.DEVICE_NAME, "android device");
cap2.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
cap2.setCapability("appPackage", "your app1 package name");
cap2.setCapability("appActivity", "your app1 package name");
cap2.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2");
smsDriver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4724/wd/hub"), caps);
}
Now to switch from app1 to app2 you can use call startApp2 method. Now if you want to switch back again to switch to app1. Use:
driver1.activateApp(appPackage of app1);
now if you again want to switch to app2 use:
driver2.activateApp(appPackage of 2nd app);
I am porting an Android app to BlackBerry 10 OS using the Java Runtime support. My app is working fine on Android devices currently, but I cannot get location updates from the BlackBerry device.
My manifest requests the COARSE_LOCATION permission:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
In my code, I request location updates from an Activity:
LocationListener listener = new LocationListener()
{
public void onLocationChanged(Location location)
{
Log.v(TAG, "onLocationChanged");
// Code to save returned location...
}
public void onStatusChanged(String provider, int status, Bundle extras) {}
public void onProviderEnabled(String provider) {}
public void onProviderDisabled(String provider) {}
};
LocationManager lm = (LocationManager)this.getSystemService(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, listener);
Log.v(TAG, "Registered network location listeners");
I see the "registered listeners" log line printed from the device, but I never see "onLocationChanged" get logged, and my code that saves the supplied location is never invoked.
In some other place, I try to fetch the last known location:
LocationManager lm = (LocationManager)this.getSystemService(Context.LOCATION_SERVICE);
Location lastLocation = lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
lastLocation is always null.
To be clear, this code works fine on Android devices and is well tested.
Also relevant: the BB10 device reports that my app has the GPS location permission, but not the regular location permission, even though my manifest requests COARSE_LOCATION only. Might be related?
UPDATE:
I have an open ticket with BlackBerry Support. They say "This is a known issue it is in the process of being fixed with internal development."
Do you have read geo location permission set in your bar descriptor xml file ?
http://developer.blackberry.com/air/documentation/bb10/r_barfile_dtd_ref_permission.html
The problem was in the BlackBerry Android runtime. It has been fixed in OS 10.1.
The support ticket is here (now closed): https://www.blackberry.com/jira/browse/BBTEN-999
See this forum thread also: http://supportforums.blackberry.com/t5/Android-Runtime-Development/Can-not-fetch-location-using-network-provider/m-p/2424553#M5040
I can not be more clear with the title :D
Is it possible? to launch an application on a blackbeery just cliking on a "link" inside a mail? i read about taping a url and going to the application but this is much more specific.
thx in advance
Actually you can listen incoming emails.
You can implement menu item that will be available in mail app.
But you can also implement content handler with specific URI to launch your app.
All examples are available in BB samples.
Look in the RIM sample apps, more specifically HTTPFilterDemo.
You have to register a filter for the type of link you need the app to be triggered by (you'll need to put this code in the main method of you app):
HttpFilterRegistry.registerFilter("www.rim.com","com.rim.samples.device.httpfilterdemo.filter");
where "www.rim.com" is obviously the link that should open the app and the second parameter is the package that contains the "Protocol" class. The Protocol class has a callback method:
public Connection openFilter( String name, int mode, boolean timeouts ) throws IOException {
This method will be called each time the user clicks on a link that has the form specified by you. So, to open the app, in the "openFilter" method, do:
int modHandle = CodeModuleManager.getModuleHandle("YourAppModuleName");
ApplicationDescriptor[] apDes = CodeModuleManager.getApplicationDescriptors(modHandle);
try {
ApplicationManager.getApplicationManager().runApplication(apDes[0]);
} catch (ApplicationManagerException e) {
e.printStackTrace();
}
I am trying to get the network prompt so that user can provide the credentials.
I saw this and It does not help. Could somebody provide a more complete example?
The goal is is to get this from a Word Add-in so that I can create work items in TFS from the function points mentioned in the word document. So, somebody writes the function points in a document, closes it and It would ask for the network credentials so that It can create work items in the TFS.
You want to use the UICredentialsProvider when connecting. Here's an example that shows how you would connect to a TFS 2010 Project Collection:
// Connect to a project collection by Uri
try
{
var projectCollectionUri = new Uri("http://tfs2010:8080/tfs/MyCollection");
var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(projectCollectionUri, new UICredentialsProvider())
projectCollection.EnsureAuthenticated();
}
catch (TeamFoundationServerUnauthorizedException ex)
{
// handle access denied
}
catch (TeamFoundationServiceUnavailableException ex)
{
// handle service unavailable
}
catch (WebException ex)
{
// handle other web exception
}
I would like to use gtalk or any other messenger in my application but i don't know how to do this.can u please give me idea about how to solve this one.if u can provide me some web link to know more about this.
BB KB - How To - Launch a third-party application from another third-party application
Try this for standard BB Messanger:
int mh = CodeModuleManager.getModuleHandle("net_rim_bb_qm_peer");
if (mh == 0) {
try {
throw new ApplicationManagerException(
"BB Messanger isn't installed");
} catch (ApplicationManagerException e) {
System.out.println(e.getMessage());
}
}
ApplicationDescriptor ad = CodeModuleManager
.getApplicationDescriptors(mh)[0];
ApplicationDescriptor ad2 = new ApplicationDescriptor(ad, null);
try {
ApplicationManager.getApplicationManager()
.runApplication(ad2, true);
} catch (ApplicationManagerException e) {
System.out.println(e.getMessage());
}
You can start any other app by module name, just replace
"net_rim_bb_qm_peer"
UPDATE And if you want examples of blackberry open source messengers, see:
BlackChat - ICQ chatting software
jmIrc - IRC MIDlet for mobile phones
WLIrc - IRC Client for Java cell phones or any other device who support java MIDP 1.0 (j2ME).
If you are also interested in developing on Android or iPhone platforms, you can build on top of Kik Messenger using Kik API. It lets you to piggyback rich media content and files over the Kik's own transport. The API itself is very simple to use - about 5 lines of code are needed to integrate it into your app. You may give it a shot here: http://www.kik.com/dev
Disclaimer: I am one of the developers behind Kik API :)