我想直接从我的应用程序中打开谷歌街景Android。有人能帮我做这个吗?
我已经成功地打开了Streeview的地图应用程序,多亏了它,但这不是我想要的。
我实际上想打开街景相机直接从我的应用程序,以便我可以采取全景照片。
我的实际任务是开发一个可以拍摄全景图像的相机应用程序,但是我找不到任何东西,所以我正在做一些事情,而不是像纸板这样的相机应用程序。下面是我之前问过的问题的链接-- App to capture 360 View android
请帮帮忙!
发布于 2018-03-14 11:14:00
您可以通过PackageManager类获得启动意图:
PackageManager pm = context.getPackageManager();
Intent launchIntent = pm.getLaunchIntentForPackage("com.google.android.street");
context.startActivity(launchIntent);请注意,如果找不到包,则getLaunchIntentForPackage将返回null。因此,您可能需要添加一个空检查:
if (launchIntent != null) {
context.startActivity(launchIntent);
} else {
Toast.makeText(context, "StreetView not Installed", Toast.LENGTH_SHORT).show();
launchPlayStore(mContext,com.google.android.street);
}您可以使用下面的代码导航他,通过play商店安装StreetView应用程序
public void launchPlayStore(Context context, String packageName) {
Intent intent = null;
try {
intent = new Intent(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse("market://details?id=" + packageName));
context.startActivity(intent);
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName)));
}
}您还可以打开Streetview摄像机,用下面的代码单击我的应用程序中的全景图像
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.google.android.street", "com.google.android.street.CameraActivity"));
//provided you should know the camera activity name
startActivity(intent);此外,您可能需要将android:exported="true"添加到正在调用上述代码的活动的manifest中。
发布于 2018-03-14 11:29:24
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.google.android.street"));
context.startActivity(intent);@Rajat您可以使用上面的代码将用户重定向到Google Street View play商店页面。
https://stackoverflow.com/questions/49276120
复制相似问题