If you opened a link like this on your android phone Google maps will automatically open and show you the location on it's map.
I want to make my app receive intents if the user opened a link like this and also i want to get the lat,long from that link.
Is this Possible ?
Assuming the link is stored as String variable link
Now,
String[] split_link = link.split(Pattern.quote("#"));
String[] post_link = split_link[1].split(Pattern.quote(","));
double lattitude = Double.parseDouble(post_link[0]);
double longitude = Double.parseDouble(post_link[1]);
Try This!!
Related
I am developing an andorid app which post some photo on Facebook, at the same time I want to calculate the number of likes of that photo from my android app.
For information -
I am using Facebook SDK and I have successfully logged in Facebook account and posted the image.
The method which post image is below
private void PublishImage()
{
Bitmap image = BitmapFactory.decodeResource(getResources(),R.mipmap.ic_launcher);
//Here we set all the required parameters to share the image and build that
SharePhoto photo = new SharePhoto.Builder()
.setBitmap(image)
.setCaption("Testing Sharing Feature through java")
.build();
//Now we share the PhotoContent by adding the properties in instance of SharePhotoContent
share = new SharePhotoContent.Builder()
.addPhoto(photo)
.build();
//Now we use share API to share the image
ShareApi.share(share,null);
}
How to calculate the number of likes of posted photo with java instead of using Graph API Explorer manually ?
I don't think you can do that without the graph API. Once you call ShareApi.share (), there is actually a graph API request which uploads the photo, and you will get likes from various platforms, your app has no way of knowing how many likes have been posted
I have been trying to use this feature available under the developer options on a android device. i am a tester so trying to fake a location on android device. I have already given permission ACCESS_MOCK_LOCATION under android manifest permissions. Not sure what and where should i put my fake longitude and latitude in my code. does anyone have tried it before? I am new to code and a tester so don't have idea what code should i write for fake long and lat and where should i put it. I have the source code for my test app and its a health app with maps on the home screen.
After instantiating your LocationClient you can call locationclient.setMockMode(true);
After that you can have your code generate Location objects like so
public Location createLocation(double lat, double lng, float accuracy) {
// Create a new Location
Location newLocation = new Location(PROVIDER);
newLocation.setLatitude(lat);
newLocation.setLongitude(lng);
newLocation.setAccuracy(accuracy);
return newLocation;
}
After that you could do something like
Location testLocation = createLocation(12.34, 45.679, 9.0f);
and
locationClient.setMockLocation(testLocation);
(This is taken from here)
This blog describes how to use mock locations when debugging and turning them off when not debugging.
I Have a Create Android Application With Eclipse , But I Have a Problem ...
I Want to go my custom google map with URl and see device's current location in my map on the device
For Example :
I have a button in one of pages on app , when touch button in the page go to the my custom google map (URL) and show the device's current location.
tanks for your help
Get current Latitude and Longitude using LocationManager.
simply replace the values in the following string with my start and current Lng/Lat
http://maps.google.com/maps?saddr=START_ADD&daddr=DEST_ADD&ll=START_ADD
Then launch the url like this in android, which will let the user choose to either use the browser or their native maps app:
String url = "http://maps.google.com/maps?saddr=START_ADD&daddr=DEST_ADD&ll=START_ADD";
startActivity( new Intent(Intent.ACTION_VIEW).setData(Uri.parse(url)));
I building an app that contains many addresses. A user can select an address in a listview. This should automatically show a user directions to that address from the users current location.
String uri = "geo:"+ selectedAddress.getLat+","+getLng();
StartActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(uri)));
I know all this does is show the location of the specified co-ords.
How would i go about showing the directions to the location from the users current location?
How would i go about showing the directions to the location from the users current location?
As #Frxstrem indicated, there is no documented and supported Intent to bring up directions.
ask the user for the place and do the following way:
String place="";//user gives the place.
String url = "http://maps.google.com/maps?daddr="+place;
Intent drn = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url));
startActivity(drn);
Google will automatically take the current user location as starting point and give directions
Is it possible to add a blackberry PIN to a device's 'black berry messenger' contact list programmatically?
Can anyone verify this for me?
I have looked through the API, but I do not see a clear way.
Thank you.
Before you begin: Make sure that you have completed the task, Register your application with the BlackBerry Messenger platform, and that the class that displays the MyBBMChatScreen screen passes in a reference to the application's associated BBMPlatformContext object into the screen's contructor. (as always :D)
I use this codes to add just one contact. You can modify it to add multiple contact. Just change the size of contacts array.
String PIN = "123456";
String name = "Someone";
BBMInvitationRequest[] contacts = new BBMInvitationRequest[1];
contacts[0] = new BBMInvitationRequest(PIN, name);
platformContext.getUIService().inviteToBBM(contacts);
May this help :)