Hi, everyone. I am working on integration that will allow users to pay for in-game items using their credit and i need their phone numbers as part of the authentication process. I know that I need to do the following in android native code to get the phone number
TelephonyManager telephonyManager (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String mMobileNo = telephonyManager.getLine1Number();
Add following permission in AndroidManifest.xml
But how do I implement this in unity? Any help would be amazing thanks.
Unity IAP should handle all of your needs but it might not be straight forward if this is your first time implementing custom IAPs via Unity.
“With Unity IAP, setting up in-app purchases across iOS, Mac, Google Play, Windows and other app stores has never been easier. You can enable in-app purchases across multiple stores with a single unified API. Once enabled, you get the insight you need to fully understand and optimize your in-game economy.”
Thanks for the reply but I have already integrated unity IAP. What we are working on is a solution for, markets with low credit card penetration. Let me know if you have any insight on how to implement what I asked
First, you would need to request the permission of the user:
Some people have successfully obtained the Android TelephonyManager data from Unity:
However, this requires mixing java and unity, and is in general an invasive technique, that will displease users with multiple phone numbers.
Just ask the damn user for their phone numbers.