2015年5月28日发布的Google相册应用是否有API允许上传照片?该应用程序似乎建立在Picassa和Google+上.可以使用其中一个API上传到Google相册吗?
我的应用程序可以从库中选择照片.我想要从这个选择中获取文件路径.
这是创建选择照片的意图的代码:
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, INTENT_REQUEST_CODE_SELECT_PHOTO);
Run Code Online (Sandbox Code Playgroud)
这是从URI获取文件路径的代码:
Cursor cursor = null;
String path = null;
try {
String[] projection = { MediaStore.Images.Media.DATA };
cursor = context.getContentResolver().query(contentUri, projection, null, null, null);
int columnIndex = cursor.getColumnIndexOrThrow(projection[0]);
cursor.moveToFirst();
path = cursor.getString(columnIndex);
} finally {
if (cursor != null) {
cursor.close();
}
}
return path;
Run Code Online (Sandbox Code Playgroud)
在昨天更新Google相册应用之前,一切都运转良好.path
解析URI后现在为null.
URI类似于: content://com.google.android.apps.photos.contentprovider/0/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F75209/ACTUAL
我还试图用Intent.ACTION_GET_CONTENT动作创建意图 - 没有运气.
最近,Google为Google+(加号)添加了照片应用,当您启动Intent选择图片时,它会显示出来.但是,如果我从Google+照片中选择图片并尝试在我的应用程序中使用它,我当前的逻辑都无法返回可用的URI或URL来实际获取我可以下载和操作的图像.我目前正在使用"常用"方法来尝试操作可在Stack Overflow和其他地方找到的URI.如果需要,我可以提供代码,但此时我觉得它有点无关紧要,因为除了这个新的应用程序之外,它适用于其他所有内容.关于如何获得可用图像的任何想法?
URI看起来如下所示:
content://com.google.android.apps.photos.content/0/https%3A%2F%2Flh5.googleusercontent.com%<a bunch of letters and numbers here>
Run Code Online (Sandbox Code Playgroud)
无论我从Google照片应用中选择什么,MediaColumns.DATA
信息始终返回null并MediaColumns.DISPLAY_NAME
始终返回image.jpg.如果我尝试将所有内容从https粘贴到浏览器的末尾,则不会出现任何问题.不知道如何从中获取有用的信息.
我知道,有一个较早的帖子这里有同样的问题.但它在2012年被问到,答案也是几年前的答案.这也是关于Google+照片,我问的是Google相册
最近谷歌照片已经成为一项闪亮的新服务,新的公告是关于无限量上传照片(照片尺寸<16 MB).我目前正在上传到Google云端硬盘的服务.我查看了Google Developer网站,但没有找到任何与Google相关的内容.
那么新的Google相册是否有任何开放的API?有没有人有任何信息?我很感激你的意见.
我的应用允许用户从其他应用导入他们的照片和视频.现在谷歌用Google照片取代了Google+照片,但有些事情让我感到震惊.其中一件事是在应用重启后重新使用导入的文件.我感觉他们已经收紧了Google照片使用图片URI返回意图时发出的权限,因此在我的应用程序被杀后,它不再拥有访问上传文件的权限.我正在接受安检:
java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.photos.contentprovider.MediaContentProvider from ProcessRecord{2c17ab9e 2124:com.myapp.myapp/u0a436} (pid=2124, uid=10436) that is not exported from uid 10427
Run Code Online (Sandbox Code Playgroud)
编辑:
我也在重复使用提供的文件时遇到同样的问题 com.google.android.apps.docs.sync.filemanager.FileProvider
有什么建议/解决方法吗?我知道我可以在失去许可之前阅读该文件,所以理论上我可以复制它,但我不能说我非常喜欢这个...
我发布了从画廊获取照片的意图,当我在我的画廊中使用nexus谷歌照片应用程序一切正常.
但如果图片不在手机上(在Google相片在线服务上),它会为我下载.选择图像后,我将图像发送到另一个活动进行裁剪,但在下载的情况下,发送到裁剪活动的图像为空,因为下载尚未完成.
如何知道下载完成后将图像发送到裁剪活动?
这是我的代码:
private void pickFromGallery()
{
Intent galleryIntent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(galleryIntent, RESULT_LOAD_IMG);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
try {
// When an Image is picked
if (requestCode == RESULT_LOAD_IMG && resultCode == Activity.RESULT_OK
&& null != data) {
// Get the Image from data
Uri selectedImage = data.getData();
String[] filePathColumn = {MediaStore.Images.Media.DATA};
// Get the cursor
Cursor cursor = getApplicationContext().getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
// Move to first …
Run Code Online (Sandbox Code Playgroud) 我一直在阅读关于Google Photos的每个StackOverflow问题,但我还没有找到答案.
对于我的Rails应用程序,我需要获取在Google相册上上传的每张照片的网址.
我不能将Picasa用于长期项目,G Drive API找不到所有照片,G +找不到所有照片
请帮助我找到解决方案Oo它可以是基于Javascript的,或基于卷曲的,我会翻译它.
提前致谢!
UPDATE
我找到了https://github.com/howdy39/google-picker-api-demo,它让我可以将所有照片都放到相册中.这是件事,但我希望谷歌能尽快发布更好的Google相册API.:)
picasa google-api google-plus google-drive-api google-photos
当我通过API查询Google照片中的照片时,它不会返回与图像相关联的任何位置数据.当我在Google相册中查看有关图片的信息时,我可以在地图上看到该位置,但API并未向我提供这些坐标.
[mediaMetadata] => Google_Service_PhotosLibrary_MediaMetadata Object
(
[creationTime] => 2018-07-13T13:20:38Z
[height] => 4032
[photoType:protected] => Google_Service_PhotosLibrary_Photo
[photoDataType:protected] =>
[videoType:protected] => Google_Service_PhotosLibrary_Video
[videoDataType:protected] =>
[width] => 3024
[internal_gapi_mappings:protected] => Array
(
)
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
[photo] => Google_Service_PhotosLibrary_Photo Object
(
[apertureFNumber] => 1.8
[cameraMake] => Apple
[cameraModel] => iPhone 8
[exposureTime] =>
[focalLength] => 3.99
[isoEquivalent] => 50
[internal_gapi_mappings:protected] => Array
(
)
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
)
)
Run Code Online (Sandbox Code Playgroud) 我正在使用新设计库开发Android应用程序.我想创建一个类似的滚动效果,用于新的Google相册应用.我希望AppBarLayout完全滚出屏幕,以便回收器视图在状态栏后面滚动.
我在应用程序的主题中将windowTranslucentStatus设置为true.这是主要活动的xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
这是滚动下来时的样子:
工具栏不会完全消失.
感谢帮助!
android android-scroll google-photos material-design android-toolbar