首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Evernote或evernote小部件和缩略图

Evernote或evernote小部件和缩略图
EN

Stack Overflow用户
提问于 2013-06-15 21:43:26
回答 2查看 297关注 0票数 0

您是否知道evernote小部件使用的方法或方法来检索我们在主界面或小部件中以非常方便的方式(在检索整个笔记之前)看到的缩略图?我看到了通过http请求的post方法,但当不共享笔记时,它似乎很复杂,也许有更简单的方法,通过直接evernote API调用或通过读取应用程序存储的文件?

EN

回答 2

Stack Overflow用户

发布于 2013-07-23 07:01:14

该小工具从Evernote应用程序的内容提供商中提取缩略图。

像这样的东西应该行得通。

在您的清单中:

代码语言:javascript
复制
<permission android:name="evernote.permission.READ_DATA" android:protectionLevel="normal" />

在你的java代码中:

代码语言:javascript
复制
final Uri AUTHORITY_URI = Uri.parse("content://com.evernote.evernoteprovider");
final Uri NOTE_URI = Uri.withAppendedPath(AUTHORITY_URI, "notes");

private FileDescriptor getNoteThumbnail(Context context, String noteGuid) throws FileNotFoundException {

    Uri thumbnailUri = NOTE_URI.buildUpon().appendEncodedPath(noteGuid).appendPath("thumbnail").appendPath("data").build();
    ContentResolver cr = context.getContentResolver();
    return cr.openFileDescriptor(thumbnailUri, "r").getFileDescriptor();

}
票数 0
EN

Stack Overflow用户

发布于 2014-07-23 05:54:28

HTTP Post方法并不太复杂。我不熟悉Java,但这是一个用python编写的示例,它可以非常直接地移植到android:

代码语言:javascript
复制
import requests

ACCESS_TOKEN="INSERT YOUR AUTH TOKEN OR DEV TOKEN HERE"

payload={'auth':ACCESS_TOKEN} #map auth token to param "auth"
r=requests.post('https://sandbox.evernote.com//shard/s1/thm/note/e679c010-d8b2-4644-9eag-56bd31c84be7.jpg?size=75',data=payload, stream=True)  #returns a binary of the picture type in header

f=open('thumbnail.jpg','wb') #open file for binary writing
f.write(r.content) #write binary contents of request to a file
f.close()  #close the file

POST请求的唯一参数是" auth“,它应该包含您的auth标记(或dev标记)。其余信息来自URL本身,格式如下:

代码语言:javascript
复制
[domain].evernote.com/shard/[shard]/thm/note/[guid]

哪里

域名为沙箱(沙箱)和www (生产)

分片是账户所在的分片(应该类似于s1)

guid是笔记本guid

将可选参数附加到.jpg、.gif、.bmp或.png的末尾,并将可选参数附加到URL ?size=1 to 299的末尾

例如,在包含分片s1的沙箱上,注意guid "e669c090-d8b2-4324-9eae-56bd31c64af7“,以返回大小为150px正方形的jpg,URL将如下所示:

代码语言:javascript
复制
https://sandbox.evernote.com/shard/s1/thm/note/e669c090-d8b2-4324-9eae-56bd31c64af7.jpg?size=75
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17124294

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档