I'm developing an Android application and I need to open the inbuilt google maps which is present in the mobile from the application which I'm creating. On clicking the button, it should open the inbuilt google maps. Similar way I need to open camera. Where and how to do this? Kindly help me.
Asked
Active
Viewed 113 times
2 Answers
1
You can open another app via Intent. You can issue an intent with explicit package name (see start application knowing package name).
This will work fine for Google Maps, but for Camera the situation is more complicated.
There is no one official Google camera app available on all android devices, some manufacturers use their custom versions, and don't use the same package name.
Luckily, all camera apps are expected to register for the MediaStore.ACTION_IMAGE_CAPTURE intent. By probing the subscribers of this intent you can find one or more package names that you can launch as camera apps.
0
for google map app
String uriBegin = "geo:" + latLng;
String query = latLng + "(" + 1 + ")";
String encodedQuery = Uri.encode(query);
String uriString = uriBegin + "?q=" + encodedQuery + "&z=16";
Uri uri = Uri.parse(uriString);
Intent mapIntent = new Intent(android.content.Intent.ACTION_VIEW, uri);
startActivity(mapIntent);

V-rund Puro-hit
- 5,518
- 9
- 31
- 50