谷歌已经更新了其计费系统,目前还没有完整的信息如何处理。
因此,SkyDetails我们没有 class ProductDetails。我们可以在 的回调中接收到这个对象billingClient.queryProductDetailsAsync()。然后我们可以调用getSubscriptionOfferDetails()这个对象并访问ProductDetails.PricingPhases. 例如,如果产品有 2 个优惠(基本优惠和试用优惠),我们会得到 2 的列表ProductDetails.PricingPhases。
然后当用户想要购买产品时我们使用这个(来自官方文档):
val offerToken = productDetails.offerDetails(selectedOfferIndex).offerToken
Run Code Online (Sandbox Code Playgroud)
什么是selectedOfferIndex?我们应该始终选择第一项还是视情况而定?
预先感谢大家。
我正在我的应用程序中添加共享功能,除了共享到 Snapchat 之外,一切正常。当我发送“发送”意图时,Snapchat 只会打开它自己的相机预览,而我的照片丢失了。我尝试了不同的东西,但没有任何帮助。此外,当我通过标准的 Android 共享屏幕共享时,Snapchat 成功打开了它。所以这是我的代码:
var tempFile = File(filePath)
val sharingIntent = Intent(Intent.ACTION_SEND)
sharingIntent.type = "image/jpg"
sharingIntent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
val image = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID, tempFile)
sharingIntent.putExtra(Intent.EXTRA_STREAM, image)
sharingIntent.`package` = "com.snapchat.android"
return sharingIntent
Run Code Online (Sandbox Code Playgroud)
我使用 FileProvider :
<provider
android:name="android.support.v4.content.FileProvider"
android:grantUriPermissions="true"
android:exported="false"
android:authorities="${applicationId}">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_path"/>
</provider>
Run Code Online (Sandbox Code Playgroud)
还有这样的路径:
<paths>
<cache-path name="cache" path="/" />
Run Code Online (Sandbox Code Playgroud)
你能帮我弄清楚是什么问题吗?感谢所有的答案!