You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi How to get Email Playstore when use subscription an additional call to the Google Play Developer API. The subscription purchase
i have use get in code
` private suspend fun checkSubscription() {
var subscriptionPurchase = SubscriptionPurchase()
try {
val credential = subscriptionPurchase.getGoogleCredential(requireContext())
val androidPublisher = subscriptionPurchase.getAndroidPublisher(credential)
val subscriptionPurchase = subscriptionPurchase.getSubscriptionPurchase(androidPublisher, PACKAGE_NAME, SUBSCRIPTION_ID, PURCHASE_TOKEN)
Log.d("SubscriptionChecker", "Subscription Status: ${subscriptionPurchase?.emailAddress}")
// Check if email is present
if (subscriptionPurchase?.emailAddress != null) {
Log.d("SubscriptionChecker", "User Email: ${subscriptionPurchase.emailAddress}")
} else {
Log.d("SubscriptionChecker", "Email address not available for this purchase.")
}
} catch (e: Exception) {
e.printStackTrace()
Log.d("SubscriptionChecker Error", e.message.toString())
}
}
public fun getAndroidPublisher(credential: GoogleCredential): AndroidPublisher {
return AndroidPublisher.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
// .setApplicationName(APPLICATION_NAME)
.build()
}
public suspend fun getSubscriptionPurchase(
androidPublisher: AndroidPublisher,
packageName: String,
subscriptionId: String,
token: String
): SubscriptionPurchase? {
return withContext(Dispatchers.IO) {
androidPublisher.purchases().subscriptions().get(packageName, subscriptionId, token).execute()
}
}
public fun getGoogleCredential(context: Context): GoogleCredential {
val assetManager = context.assets
val inputStream: InputStream = assetManager!!.open(SERVICE_ACCOUNT_FILE_PATH)
return GoogleCredential.fromStream(inputStream)
.createScoped(listOf(AndroidPublisherScopes.ANDROIDPUBLISHER))
}`
and i. debug code in show detail. and why. not get email. please help
The text was updated successfully, but these errors were encountered:
PongPloy2016
changed the title
How to get email in playstore when user subscription an additional call to the Google Play Developer API. The subscription purchase
How to get email in users data in google play subscriptions an additional call to the Google Play Developer API. The subscription purchase
Jul 9, 2024
You cant get email through the Google Play Developer API for most (practically all) users. If you look at the docs the emailAddress The email address of the user when the subscription was purchased. Only present for purchases made with 'Subscribe with Google'. Subscribe with Google was a very specific service that Google tried to introduce in 2018 that no one really uses anymore. https://blog.google/outreach-initiatives/google-news-initiative/introducing-subscribe-google/
hi How to get Email Playstore when use subscription an additional call to the Google Play Developer API. The subscription purchase
i have use get in code
` private suspend fun checkSubscription() {
val assetManager = context.assets
val inputStream: InputStream = assetManager!!.open(SERVICE_ACCOUNT_FILE_PATH)
return GoogleCredential.fromStream(inputStream)
.createScoped(listOf(AndroidPublisherScopes.ANDROIDPUBLISHER))
}`
and i. debug code in show detail. and why. not get email. please help
The text was updated successfully, but these errors were encountered: