- This topic has 6 replies, 2 voices, and was last updated 9 years, 7 months ago by support-swapna.
-
AuthorPosts
-
mazhong77MemberI am reading on how to to add android billing code for in-app purchase, all I got is that I need to run this command line: cordova plugin add cc.fovea.cordova.purchase –variable BILLING_KEY=”MIIB…AQAB”
If I am adding in-app purchase plugin from MyEclipse, how can I make it work? Do I need to add the key manually in some configuration file? I am running into errors related to license key when running app in Android.
support-swapnaModeratormazhong77,
Can you please clarify if you are working with MyEclipse 2015 CI 10 or updated to MyEclipse 2015 CI 12 ?
Once you add the in-app purchase plugin (cc.fovea.cordova.purchase), you should manually add the key to the configuration file. To add the plugin, right click on the project > PhoneGap > Add Plugin. Use the Find box to search for the required plugin.
Once the plugin is installed, edit the file <projectname>/plugins/cc.fovea.cordova.purchase/plugin.xml and find the section that says <string name=”billing_key_param”> and add your Licence Key instead of the variable $BILLING_KEY.
If you are still seeing issues , then please also edit the billing_key_param.xml located at <projectname>/plugins/cc.fovea.cordova.purchase plugin/src/android and add the license key. Ex :
<resources>
<string name=”billing_key_param”>MIIB…AQAB</string>
</resources>If the above steps didn’t work, then please let us know what exact error you are seeing. If possible please also share a screenshot of the error to help us get a visual. Also let us know what steps you followed to add the in-app purchase plugin,the modifications you made to the project to support the plugin along with the PhoneGap version details.
Let us know how it works for you.
mazhong77MemberHello,
The version of MyEclipse is Version: 2015 CI 12
Build id: 13.0.0-20150323Thanks for your prompt reply. However, after I tried your method, I still received the same error and my error is shown below.
java.lang.IllegalArgumentException: com.smartmobilesoftware.util.Base64DecoderException: Bad Base64 input character at 0: 36(decimal)
at com.smartmobilesoftware.util.Security.generatePublicKey(Security.java:70)
at com.smartmobilesoftware.util.Security.verifyPurchase(Security.java:47)
at com.smartmobilesoftware.util.IabHelper.queryPurchases(IabHelper.java:864)
at com.smartmobilesoftware.util.IabHelper.queryInventory(IabHelper.java:562)
at com.smartmobilesoftware.util.IabHelper.queryInventory(IabHelper.java:540)
at com.smartmobilesoftware.util.IabHelper$2.run(IabHelper.java:635)
at java.lang.Thread.run(Thread.java:841)
Caused by: com.smartmobilesoftware.util.Base64DecoderException: Bad Base64 input character at 0: 36(decimal)
at com.smartmobilesoftware.util.Base64.decode(Base64.java:518)
at com.smartmobilesoftware.util.Base64.decode(Base64.java:446)
at com.smartmobilesoftware.util.Base64.decode(Base64.java:392)
at com.smartmobilesoftware.util.Security.generatePublicKey(Security.java:60)
… 6 moreBased on the google search, I found the similar issue reported by others on this link https://github.com/j3k0/cordova-plugin-purchase/issues/103
You can see the error by going to play store and downloading LWOD
Here is what is in my billing_key_param.xml file.
<?xml version=’1.0′ encoding=’utf-8′?>
<resources>
<string name=”billing_key_param”>MIIBIjANBgkqhkiG9wg…4v1/QIDAQAB</string>
</resources>Here is my config.xml. Please help!
<?xml version=”1.0″ encoding=”UTF-8″?>
<!– config.xml reference: https://build.phonegap.com/docs/config-xml –>
<widget xmlns=”http://www.w3.org/ns/widgets”
xmlns:gap=”http://phonegap.com/ns/1.0″ version=”1.1.9″ id=”lwod.id”
versionCode=”19″><name>LoseWeightOrDonate</name>
<description>
Lose Weight Or Donate: Diet for your Favorite Food Bank
</description><author href=”http://loseweightordonate.org”
email=”support@loseweightordonate.org”>
Austin Ma
</author><content src=”index.html” />
<!–
If you do not want any permissions to be added to your app, add the
following tag to your config.xml; you will still have the INTERNET
permission on your app, which PhoneGap requires.
–>
<preference name=”permissions” value=”none” /><!– Customize your app and platform with the preference element. –>
<preference name=”phonegap-version” value=”3.7.0″ />
<!– all: current version of PhoneGap –>
<preference name=”orientation” value=”default” />
<!– all: default means both landscape and portrait are enabled –>
<preference name=”target-device” value=”handset” />
<!– all: possible values handset, tablet, or universal –>
<preference name=”fullscreen” value=”false” />
<!– all: hides the status bar at the top of the screen –>
<preference name=”webviewbounce” value=”true” />
<!– ios: control whether the screen ‘bounces’ when scrolled beyond the top –>
<preference name=”prerendered-icon” value=”true” />
<!– ios: if icon is prerendered, iOS will not apply it’s gloss to the app’s icon on the user’s home screen –>
<preference name=”stay-in-webview” value=”false” />
<!– ios: external links should open in the default browser, ‘true’ would use the webview the app lives in –>
<preference name=”ios-statusbarstyle” value=”black-opaque” />
<!– ios: black-translucent will appear black because the PhoneGap webview doesn’t go beneath the status bar –>
<preference name=”detect-data-types” value=”false” />
<!– ios: controls whether data types (such as phone no. and dates) are automatically turned into links by the system –>
<preference name=”exit-on-suspend” value=”false” />
<!– ios: if set to true, app will terminate when home button is pressed –>
<preference name=”show-splash-screen-spinner” value=”true” />
<!– ios: if set to false, the spinner won’t appear on the splash screen during app loading –>
<preference name=”auto-hide-splash-screen” value=”true” />
<!– ios: if set to false, the splash screen must be hidden using a JavaScript API –>
<preference name=”android-minSdkVersion” value=”4″ />
<!– android: MIN SDK version supported on the target device. MAX version is blank by default. –>
<preference name=”android-installLocation” value=”auto” />
<!– android: app install location. ‘auto’ will choose. ‘internalOnly’ is device memory. ‘preferExternal’ is SDCard. –><!–
Define access to external domains.<access /> – a blank access tag denies access to all external resources.
<access origin=”*” /> – a wildcard access tag allows access to all external resource.Otherwise, you can specify specific domains:
–>
<access origin=”*” /><access origin=”*.google.com” />
<access origin=”*.googleapis.com” /><!–
<access origin=”http://phonegap.com” /> – allow any secure requests to http://phonegap.com/
<access origin=”http://phonegap.com” subdomains=”true” /> – same as above, but including subdomains, such as http://build.phonegap.com/
<access origin=”http://phonegap.com” browserOnly=”true” /> – only allows http://phonegap.com to be opened by the child browser.
–><!– enable PhoneGap Build to create a remotely debuggable app –>
<!– remove the following segment for production ver of app –>
<gap:config-file parent=”/manifest” platform=”android”
xmlns:android=”http://schemas.android.com/apk/res/android”>
<application android:debuggable=”false” />
</gap:config-file><!– Plugins –>
<!–
<gap:plugin name=”Example” />
A list of available plugins are available at https://build.phonegap.com/docs/plugins
–><gap:plugin name=”org.apache.cordova.camera” version=”0.3.3″
source=”plugins.cordova.io”>
</gap:plugin>
<gap:plugin name=”org.apache.cordova.geolocation” version=”0.3.10″
source=”plugins.cordova.io”>
</gap:plugin>
<gap:config-file platform=”ios”
parent=”NSLocationAlwaysUsageDescription” mode=”merge”>
<array>
<string>Allow GPS</string>
</array>
</gap:config-file>
<gap:plugin name=”org.apache.cordova.inappbrowser” version=”0.5.3″
source=”plugins.cordova.io”>
</gap:plugin><preference name=”deployment-target” value=”6.0″ />
<gap:plugin name=”cc.fovea.cordova.purchase” version=”3.10.1″
source=”plugins.cordova.io”>
</gap:plugin>
<icon gap:platform=”android” gap:qualifier=”ldpi”
src=”res/icon/android/logo-36-36.png” />
<icon gap:platform=”android” gap:qualifier=”mdpi”
src=”res/icon/android/logo-48-48.png” />
<icon gap:platform=”android” gap:qualifier=”hdpi”
src=”res/icon/android/logo-72-72.png” />
<icon gap:platform=”android” gap:qualifier=”xhdpi”
src=”res/icon/android/logo-96-96.png” />
<icon gap:platform=”android” gap:qualifier=”xxhdpi”
src=”res/icon/android/logo-144-144.png” />
<icon gap:platform=”android” gap:qualifier=”xxxhdpi”
src=”res/icon/android/logo-192-192.png” />
<icon src=”www/res/icon/android/logo-96-96.png” />
<gap:platform name=”android” />
<gap:splash gap:platform=”android” gap:qualifier=”port-ldpi”
src=”res/screen/android/screen-ldpi-portrait.png” />
<gap:splash gap:platform=”android” gap:qualifier=”port-mdpi”
src=”res/screen/android/screen-mdpi-portrait.png” />
<gap:splash gap:platform=”android” gap:qualifier=”port-hdpi”
src=”res/screen/android/screen-hdpi-portrait.png” />
<gap:splash gap:platform=”android” gap:qualifier=”port-xhdpi”
src=”res/screen/android/screen-xhdpi-portrait.png” />
<gap:splash gap:platform=”android” gap:qualifier=”land-ldpi”
src=”res/screen/android/screen-ldpi-landscape.png” />
<gap:splash gap:platform=”android” gap:qualifier=”land-mdpi”
src=”res/screen/android/screen-mdpi-landscape.png” />
<gap:splash gap:platform=”android” gap:qualifier=”land-hdpi”
src=”res/screen/android/screen-hdpi-landscape.png” />
<gap:splash gap:platform=”android” gap:qualifier=”land-xhdpi”
src=”res/screen/android/screen-xhdpi-landscape.png” />
<gap:config-file platform=”android” parent=”/manifest” mode=”add”
xmlns:android=”http://schemas.android.com/apk/res/android”>
<uses-permission
android:name=”android.permission.ACCESS_COARSE_LOCATION”>
</uses-permission>
<uses-permission
android:name=”android.permission.ACCESS_FINE_LOCATION”>
</uses-permission>
<uses-permission
android:name=”android.permission.ACCESS_LOCATION_EXTRA_COMMANDS”>
</uses-permission>
<uses-permission
android:name=”android.permission.ACCESS_MOCK_LOCATION”>
</uses-permission>
<uses-permission
android:name=”android.permission.READ_EXTERNAL_STORAGE”>
</uses-permission>
<uses-permission
android:name=”android.permission.WRITE_EXTERNAL_STORAGE”>
</uses-permission>
<uses-permission android:name=”android.permission.INTERNET”></uses-permission>
<uses-permission android:name=”com.android.vending.BILLING” />
</gap:config-file>
</widget>
support-swapnaModeratormazhong77,
Sorry that you are still seeing issues.
Thank you for pointing to the link : https://github.com/j3k0/cordova-plugin-purchase/issues/103 .Couple of users could get it working as per their comments on the link. Did you try their suggestions ?
While we investigate the issue at our end, please check if any of the suggestions work at your end.
Let us know how it works for you.
mazhong77MemberYes, I tried the approach mentioned in thread 103 too but still not working.
Thanks,
mazhong77MemberI have an idea here, you must have one simple sample code which can demo the in-app purchase from Android with MyEclipse, Can you give me the demo code please? I will try to see if it works or not for me.
Thanks much!
support-swapnaModeratormazhong77,
I am afraid we do not have any sample code to demo the in-app purchase. This is a development related query and I was just trying to provide some assistance. I suggest you check on development forums related to PhoneGap for better support from the developer community.
Let us know if you have any questions.
-
AuthorPosts