在我的Google Play控制台中,我链接了一个项目.然后我创建了一个服务帐户.尽管如此,在刷新控制台时,仍然会说"没有与您的项目关联的服务帐户".已经等了24个多小时了.所有这一切的目的是收据验证.
android google-api service-accounts receipt-validation google-play-console
我按照本教程:https://medium.com/@infinitesimal_/doing-android-purchase-validation-api-v3-in-java-5c46fc837368
但我不能让它发挥作用!我能得到的就是:
{
"code" : 401,
"errors" : [ {
"domain" : "androidpublisher",
"message" : "The current user has insufficient permissions to perform the requested operation.",
"reason" : "permissionDenied"
} ],
"message" : "The current user has insufficient permissions to perform the requested operation."
}
Run Code Online (Sandbox Code Playgroud)
这是我的java代码:
HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();
String applicationName = "My App";
String packageName = "com.my.package";
final Set<String> scopes = Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER);
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.setServiceAccountId("myAccoutId")
.setServiceAccountScopes(scopes) …Run Code Online (Sandbox Code Playgroud) android in-app-purchase service-accounts google-play-developer-api google-play-console
我使用下面的代码检索android 8.1手机上的android锁屏壁纸:
WallpaperManager manager = WallpaperManager.getInstance(getActivity());
ParcelFileDescriptor pfd = manager.getWallpaperFile(WallpaperManager.FLAG_LOCK);
if (pfd == null) // pfd is always null for FLAG_LOCK, why?
return;
Bitmap lockScreenWallpaper = BitmapFactory.decodeFileDescriptor(pfd.getFileDescriptor());
// ...
Run Code Online (Sandbox Code Playgroud)
我已经授予了READ_EXTERNAL_STORAGE许可并预先设置了锁屏壁纸.
我在真正的手机上运行演示,发现pfd它总是为空FLAG_LOCK,所以我无法获得锁屏壁纸.请帮忙解决问题,谢谢.
我想事先知道视图的大小。我是这样测量它的大小的。
public static int[] measureSize(ViewGroup parent, int layoutId)
{
View view = LayoutInflater.from(parent.getContext()).inflate(layoutId, parent, false);
final int spec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
view.measure(spec, spec);
final int width = view.getMeasuredWidth(); // ? 0, not include compound drawable size and relative padding. WHY
final int height = view.getMeasuredHeight();
return new int[]{width, height};
}
Run Code Online (Sandbox Code Playgroud)
这是布局文件:
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="?android:listChoiceIndicatorSingle"
android:drawablePadding="20dp"/>
Run Code Online (Sandbox Code Playgroud)
问题:测量的视图宽度始终不包括复合可绘制尺寸及其相关的填充。如果我不设置文本,则测量的宽度始终为0。如果设置非空值,则宽度仅适用于文本。为什么?我怎样才能得到正确的尺寸?
提前致谢。