I want to display blackberry maps with markers for various location within my application. I tried using net.rim.device.api.lbs.maps.ui.MapField but it throws IllegalArgumentException(Bitmap is too large)
Anyone has tried implementing net.rim.device.api.lbs.maps.ui.MapField and setting the model with Mappable or MapLocation to display various locations?
All i'm trying to do is display map with multiple location markers. On click of markers it should display a details screen for that location.
RichMapField map = MapFactory.getInstance().generateRichMapField();
MapDataModel modelMap = map.getModel();
// Your Locations
MapLocation julieHome = new MapLocation( 43.47751, -80.54817,"Julie - Home", null );
int julieHomeId = modelMap.add( (Mappable) julieHome, "julie" );
MapLocation paulHome = new MapLocation( 43.47551, -80.55335, "Paul - Home", null );
int paulHomeId = modelMap.add( (Mappable) paulHome, "paul" );
map.getMapField().update( true );
Related
I have an Yandex Maps installed on my project
Code below display an cluster view of all objects.
What I would like to do is disable clusters
$.getJSON( ymFormAction , "ymJSON=1" ).done( function (json) {
window.geoObjects = ymaps.geoQuery(json);
window.clusters = geoObjects.search("geometry.type == 'Point'").clusterize({preset: 'islands#invertedblueClusterIcons'});
myMap[[+idMap]].geoObjects.add(clusters);
// Trying to disable clusters
var coords = geoObjects;
// coords should be = [[56.023, 36.988]] according to API
var myCollection = new ymaps.GeoObjectCollection();
for (var i = 0; i<coords.length; i++) {
myCollection.add(new ymaps.Placemark(coords[i]));
}
myMap[[+idMap]].geoObjects.add(myCollection);
});
The thing is that ymaps.geoQuery doesn't return coordinates (or a GeoObjectCollection for that matter). What it returns is GeoQueryResult. Here what you can do to add results of geoQuery to a map:
ymaps.geoQuery(json).search("geometry.type == 'Point'").addToMap(yourMap);
I'm trying to retrieve TextAd (Headline,Desc1,Desc2,Display URL and Destination URL) and i failed.
This is my Code on retrieving Text ad it returns Null result
TextAd text = new TextAd();
System.out.println("Headline:"+text.getHeadline());
Syso... etc.
I want to retrieve All details of TextAd , I'm using java.
This is my the code for adding TextAd
public static void runExample(
AdWordsServices adWordsServices, AdWordsSession session, long adGroupId) throws Exception {
// Get the AdGroupAdService.
AdGroupAdServiceInterface adGroupAdService =
adWordsServices.get(session, AdGroupAdServiceInterface.class);
// Create text ads.
TextAd textAd1 = new TextAd();
textAd1.setHeadline("Luxury Cruise to Mars");
textAd1.setDescription1("Visit the Red Planet in style.");
textAd1.setDescription2("Low-gravity fun for everyone!");
textAd1.setDisplayUrl("www.example.com");
textAd1.setFinalUrls(new String[] {"http://www.example.com/1"});
TextAd textAd2 = new TextAd();
textAd2.setHeadline("Luxury Cruise to Mars");
textAd2.setDescription1("Enjoy your stay at Red Planet.");
textAd2.setDescription2("Buy your tickets now!");
textAd2.setDisplayUrl("www.example.com");
textAd2.setFinalUrls(new String[] {"http://www.example.com/2"});
// Create ad group ad.
AdGroupAd textAdGroupAd1 = new AdGroupAd();
textAdGroupAd1.setAdGroupId(adGroupId);
textAdGroupAd1.setAd(textAd1);
// You can optionally provide these field(s).
textAdGroupAd1.setStatus(AdGroupAdStatus.PAUSED);
AdGroupAd textAdGroupAd2 = new AdGroupAd();
textAdGroupAd2.setAdGroupId(adGroupId);
textAdGroupAd2.setAd(textAd2);
// Create operations.
AdGroupAdOperation textAdGroupAdOperation1 = new AdGroupAdOperation();
textAdGroupAdOperation1.setOperand(textAdGroupAd1);
textAdGroupAdOperation1.setOperator(Operator.ADD);
AdGroupAdOperation textAdGroupAdOperation2 = new AdGroupAdOperation();
textAdGroupAdOperation2.setOperand(textAdGroupAd2);
textAdGroupAdOperation2.setOperator(Operator.ADD);
AdGroupAdOperation[] operations =
new AdGroupAdOperation[] {textAdGroupAdOperation1, textAdGroupAdOperation2};
// Add ads.
AdGroupAdReturnValue result = adGroupAdService.mutate(operations);
// Display ads.
for (AdGroupAd adGroupAdResult : result.getValue()) {
System.out.println("Ad with id \"" + adGroupAdResult.getAd().getId() + "\"" + " and type \""
+ adGroupAdResult.getAd().getAdType() + "\" was added.");
}
}
How can i retrieve Those values from adwords.
this is my selector for retrieving the data from adword
SelectorBuilder builder = new SelectorBuilder();
Selector selector = builder
.fields(AdGroupAdField.Id, AdGroupAdField.AdGroupId, AdGroupAdField.Status,
AdGroupAdField.Description1,AdGroupAdField.Description2,AdGroupAdField.Headline)
.orderAscBy(AdGroupAdField.Id)
.offset(offset)
.limit(PAGE_SIZE)
.equals(AdGroupAdField.AdGroupId, adGroupId.toString())
.in(AdGroupAdField.Status, "ENABLED", "PAUSED", "DISABLED")
.equals("AdType", "TEXT_AD")
.build();
Typecast adGroupAd.getAd() to TextAd then you can get headline and other methods.
TextAd textAd = (TextAd)adGroupAd.getAd();
textAd.getHeadline();
The IMapViewDelegate apparently isn't a complete C# implementation of MapViewDelegate from objC. That inhibits the access to markerInfoContents delegate method.
I'd like to do something like this allowing me to custom the contentView layout and the tap action
got from: http://www.raywenderlich.com/81103/introduction-google-maps-ios-sdk-swift
I think i can explan its from scratch to add a Custom MarkerInfo Window on the Tap of a Marker. Iam using Xamarin.Google.iOS.Maps package from Official Nuget Library for adding Google Map on my Xamarin MVVM Cross Touch Project.
private void SetupMap()
{
if (_mapView != null)
_mapView.RemoveFromSuperview ();
//Init Map wiht Camera
var camera = new CameraPosition(new CLLocationCoordinate2D(36.069082, -94.155976), 15, 30, 0);
_mapView = MapView.FromCamera(RectangleF.Empty, camera);
_mapView.MyLocationEnabled = true;
//Add button to zoom to location
_mapView.Settings.MyLocationButton = true;
_mapView.MyLocationEnabled = true;
_mapView.Settings.SetAllGesturesEnabled(true);
var xamMarker = new Marker () {
Title = "Sample",
Snippet = "Sample Location",
Position = new CLLocationCoordinate2D (36.069082, -94.155976),
Map = _mapView
};
var xamMarker1 = new Marker () {
Title = "Sample1",
Snippet = "Sample Location2",
Position = new CLLocationCoordinate2D (35.069082, -94.155976),
Map = _mapView
};
_mapView.TappedMarker = (map, marker) => {
Console.WriteLine("Marker tapped:"+ map +"::"+marker);
_mapView.MarkerInfoWindow = new GMSInfoFor(markerInfoWindow);
return false;
};
_mapView.Frame = this.contentViewOutlet.Bounds;
this.contentViewOutlet.AddSubview (_mapView);
_mapView.InfoTapped += (object sender, GMSMarkerEventEventArgs e) => {
Console.WriteLine ("Marker Info tapped:"+e+"::"+sender);
UIAlertView alert = new UIAlertView () {
Title = "Alert", Message = sampleLongandLat
};
alert.AddButton("OK");
alert.Show ();
};
}
you can call this SetupMap() method from where ever you want. for example in ViewDidLoad or from any where you have to add the google map.
On click or Tap of the marker we are creating a custom marker window
_mapView.TappedMarker = (map, marker) => {
Console.WriteLine("Marker tapped:"+ map +"::"+marker);
_mapView.MarkerInfoWindow = new GMSInfoFor(markerInfoWindow);
return false;
};
the above code is included in the SetupMap method.
mapView.MarkerInfoWindow = new GMSInfoFor(markerInfoWindow); these above line of code will allow us to load a custom Marker Window instead of the default one
UIView markerInfoWindow(UIView view, Marker marker)
{
// use this method to return the custom view u have already created to load as a subview in Google Map as Custom Marker Info Windo
UIView v;
v = MarkerInfoView.Create(marker);
sampleLongandLat = MarkerInfoView.markerInfoString;
sampleLongandLat = MarkerInfoView.locationIDString;
return v;
}
for adding an custom UIView you can follow the example provided in the xamarin web site loading an xib or UIView in another ViewController as a sub view
_mapView.InfoTapped += (object sender, GMSMarkerEventEventArgs e) => {
Console.WriteLine ("Marker Info tapped:"+e+"::"+sender);
UIAlertView alert = new UIAlertView () {
Title = "Alert", Message = sampleLongandLat
};
alert.AddButton("OK");
alert.Show ();
};
the above code snippet you can use for detecting tap on the Marker Info Window
Can anyone please inform me how to work with blackberry location-based services?
i am working on a project for a blackberry mobile application. i never had a blackberry before and i dont have a contract with any provider (just have a sim card from 3 and mobile device 9000 OS 4.6).
In the project i am currently trying to use the following code in order to retrieve the coordinates of current location (startpoint) and destination location (endpoint). It works just fine on the simulator but on the device nothing. Should i have a contract with a provider or something? and does this need just GPS or internet, or both to work?
Code:
String destination = "London";
final Landmark[] landmarks = Locator.geocode(destination.replace('\n', ' '), null);
Coordinates endPoint = landmarks[0].getQualifiedCoordinates();
// Get a location provider.
LocationProvider provider = LocationProvider.getInstance(null);
if (provider == null)
{
throw new IllegalStateException("No LocationProvider Available!!");
}
// Try to fetch the current location and get the coordinates of the current location.
Coordinates startPoint = provider.getLocation(-1).getQualifiedCoordinates();
double destiinationlatitude = endPoint.getLatitude();
double currentlatitude = startPoint.getLatitude();
thank you in advance
To get the GPS location on any version prior to 5.0 you have to instantiate this things
Criteria
Location Provider
Location Object (done with the location provider)
Here's the things you instantiate:
Criteria criteria = null;
LocationProvider provider = null;
javax.microedition.location.Location location = null;
After that you must assign values to the Criteria, get the instance of the LocationProvider using the criteria and get the Location using the LocationProvider.
criteria = new Criteria();
criteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_HIGH);
criteria.setHorizontalAccuracy(50);
criteria.setVerticalAccuracy(50);
criteria.setCostAllowed(true);
provider = LocationProvider.getInstance(criteria);
location = provider.getLocation(5);
Note that the Criteria will determine if you use GPS, Wifi assisted location or Cellsite location, more info on the criteria setting here: http://www.blackberry.com/developers/docs/4.5.0api/javax/microedition/location/Criteria.html
After that, to get the coordinates you call the method: location.getQualifiedCoordinates()
And that's that... you should call this from a separate thread. And also the actual location management code should be on a try-catch block but the IDE will help you with that.
in this code we are seeing which modes are available to get co-ordinates(I.E if phone does not have a GPS then it should use satalite info.)
The Lat and Long is being retreived by the available mode.
A mapview is created (MapView which is the map, You set the required specifications such as the zooming, lat, lon, etc )then you invoke the map and the set zoom, lat, lon , etc will be applied to the map that reflects onto the screen.
CustomMapField mMapField;
Coordinates mCoordinates;
BlackBerryCriteria blackBerryCriteria = null;
BlackBerryLocation blackBerryLocation = null;
BlackBerryLocationProvider blackBerryLocationProvider = null;
double Doublelat = 0.0;
double Doublelng = 0.0;
blackBerryCriteria = new BlackBerryCriteria();
if(GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_CELLSITE)){
blackBerryCriteria.setMode(GPSInfo.GPS_MODE_CELLSITE);
}else if(GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_ASSIST)){
blackBerryCriteria.setMode(GPSInfo.GPS_MODE_ASSIST);
}else if(GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_AUTONOMOUS)){
blackBerryCriteria.setMode(GPSInfo.GPS_MODE_AUTONOMOUS);
}else{
blackBerryCriteria.setCostAllowed(true);
blackBerryCriteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_LOW);
} try {
blackBerryLocationProvider = (BlackBerryLocationProvider) BlackBerryLocationProvider.getInstance(blackBerryCriteria);
blackBerryLocation = (BlackBerryLocation) blackBerryLocationProvider.getLocation(60);
QualifiedCoordinates qualifiedCoordinates = blackBerryLocation.getQualifiedCoordinates();
Doublelat = qualifiedCoordinates.getLatitude();
Doublelng = qualifiedCoordinates.getLongitude();
mCoordinates = new Coordinates(Doublelat, Doublelng, 0);
MapView mapView = new MapView();
mapView.setLatitude(finalintlat);
mapView.setLongitude(finalintlng);
mapView.setZoom(10);
MapsArguments mapsArgs = new MapsArguments(mapView);
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, mapsArgs);
}catch(Exception e){
System.out.println("Error in location :"+e.toString());
System.out.println("Error in location :"+e.getMessage());
}
I am using the following code to invoke Google map in my simulator. i have already installed Google map in my simulator.
int mh = CodeModuleManager.getModuleHandle("GoogleMaps");
if(mh > 0) {
try{
URLEncodedPostData uepd = new URLEncodedPostData(null, false);
uepd.append("action","LOCN");
uepd.append("a", "#latlon:"+lat+","+log);
uepd.append("title","Stanford University School of Medicin");
uepd.append("description", "XYZ");
String[] args = { "http://gmm/x?"+uepd.toString() };
ApplicationDescriptor ad = CodeModuleManager.getApplicationDescriptors(mh)[0];
ApplicationDescriptor ad2 = new ApplicationDescriptor(ad, args);
ApplicationManager.getApplicationManager().runApplication(ad2, true);
}catch(Exception e){
System.out.println(e+"Excepton");
}}}
but i am getting a white screen , when i am pressing the menu button RUN GMAPS option is their. but when i am pressing the RUN GMAPS then also result is same only white screen is coming. i don't why it is coming. some one please help me out
i also want to Know. how to pin multiple places in google map.
thanks in advance
i think you should use kml file.
BrowserSession visit = Browser.getDefaultSession();
visit.displayPage("http://www.geochemie.uni-bremen.de/kml/borabora.kml");
you can test on simulator also.