Not able to init through phonegap build. Phonegap Inapp billing - android

I am trying using this plugin(https://github.com/poiuytrez/AndroidInAppBilling). I added this in config.xml file and then uploaded it to phonegap build
<gap:plugin name="com.smartmobilesoftware.inappbilling">
<param name="BILLING_KEY" value="" />
</gap:plugin>
I did put my BILLING_KEY in the value above. But when I run the app. I am getting error like this
index 1 out of Range[0..1)
I tried console and it says key is undefined.
I send the key during init as in option like this
inappbilling.init(successHandler, errorHandler, {showLog:true,key:vkey});
where vkey contrain my Billing key string. Still I am not able to initialize the inAppbilling. Can anyone please tell what I am actually missing.
When I see my apk file. I can see the inappbilling.js file being included in the head. I can also see com.smartmobilesoftware.inappbilling directory with in the plugin.
Any kind of help will be greatly appreciated.

I found this answer on GitHub: The official PGB plugin for this repo is com.smartmobilesoftware.androidinappbilling

Related

phonegap social sharing button issue android

I'm trying to create an app with phonegap and I want to include a sharing button. I couldn't make it so I created a new empty project from phonegap. I just have the sample page displayed and nothing else, when I try it on my phone. Now i want to simply add a basic sharing button.
Following the instructions here : https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin
I went to my project folder and just installed the plugin with the phonegap command.
Then in my index.html I simply added this :
<button onclick="window.plugins.socialsharing.share('Message only')">message only</button>
But when I click it, nothing happens.
I also tried the other given buttons and solutions but none works. Any ideas? I'm struggling with this for 2 days!
Thank you in advance for your answers :)
Have you followed this setup.
https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin#manually
Add the following xml to all the config.xml files you can find
For IOS:
<feature name="SocialSharing"><param name="ios-package" value="SocialSharing" /></feature>
For Android
<feature name="SocialSharing"><param name="android-package" value="nl.xservices.plugins.SocialSharing" /></feature>
For Windows Phone
<feature name="SocialSharing"><param name="wp-package" value="SocialSharing"/></feature>
For sharing remote images (or other files) on Android, the file needs to be stored locally first, so add this permission to AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
For iOS, you'll need to add the Social.framework and MessageUI.framework to your project.
Click your project, Build Phases, Link Binary With Libraries, search for and add Social.framework and MessageUI.framework.2.
Grab a copy of SocialSharing.js, add it to your project and reference it in index.html:
<script type="text/javascript" src="js/SocialSharing.js"></script>
Download the source files for iOS and/or Android and copy them to your project.iOS: Copy SocialSharing.h and SocialSharing.m to platforms/ios//Plugins
Android: Copy SocialSharing.java to platforms/android/src/nl/xservices/plugins (create the folders)Window Phone: Copy SocialSharing.cs to platforms/wp8/Plugins/nl.x-services.plugins.socialsharing (create the folders)

Attempting to change navigator.userAgent using Cordova for Android

I am new to all of this, so I am probably missing something pretty obvious, but I am trying to change the userAgent string in an application I am building with Cordova. Based upon the documentation at the Cordova website, it would appear that I should only need to add the following to my config.xml file:
preference name="OverrideUserAgent" value="My string value here"
So I included this line in my config.xml and then added this code to my javascript in my cordova app:
var ua = navigator.userAgent;
alert(ua);
I then build the project and install it on my android phone. However, when I run the app I get the same userAgent reported back by my alert regardless of whether I included preference name="OverrideUserAgent" value="My string value here" in the config.xml or not. I am using version 5 of Cordova (5.3.1 I believe) and this config.xml fix was listed in the documentation for version 5.1.1 on the Cordova website.
I have also seen another possible fix on stackoverflow in the following post:
Change PhoneGap / Cordova User-Agent for AJAX
Specifically I am looking at the response that recommends:
put this in your onCreate method: (after super.init();)
super.appView.getSettings().setUserAgentString("Your own agent string");
I am sorry to ask such a basic question, but how to I carry this out? Is it possible to do this while still using the Cordova CLI or do I need to import the project into Android studio first? Where exactly do I find the onCreate method that I need to modify.
Thank you for any help you may be able to offer.

push notification using Onesignal error

while trying to create a push Notification using GCM Per device or a group of devices - we are trying to use Onesignal for registration of our android users and getting an undefined error.
the code is written on JS and then build using Phonegap and realesed as an APK for android, while debugging it we get "windwos.onesignal undefined"
any lead or help would be appriciated
Thank you
(can't post the Chrome debugger message rep 10 is requered :-) )
Is windwos.onesignal exactly what you have in your code? Or is this a typo in your post?
All calls to OneSignal should be called by with window.plugins.OneSignal.
Example:
window.plugins.OneSignal.sendTag("key1", "value1");
Check to make sure window.plugins is defined where you're calling OneSignal. It should be called from your onDeviceReady function or add a 'deviceready' listener if you don't have this function. Double check your code with OneSignal's Cordova/PhoneGap install instructions.
You can also send your APK to support#onesignal.com and we can help debug your issue.
Follow the documentation here Make sure you add plugin
> cordova plugin add onesignal-cordova-plugin
And try building it locally.
>ionic build android
If it works locally there is some issue with you config file.Specify version of plugin in config file. Check your installed plugin version.
<plugin name="com.onesignal.plugins.onesignal" spec="1.9.0" source="pgb" />
Hope this helps !

Android Phonegap 2.2 Network Connection: Class Not Found

I recently upgraded my app from Phonegap 1.6 to 2.2.
I've refactored everything (ex Plugin --> CordovaPlugin) and I'm also using the new config.xml.
The app compiles and builds, however I constantly am getting an error in logcat and an error dialog box. The dialog says [ERROR] Error initializing Cordova: Class not found.
The logcat error is:
Line 6048 : Error initializing Network Connection: Class not found
What could I be missing?
The issue happens on multiple devices.
Update
I've already changed the config.xml for the network status plugin from Network Status to NetworkStatus. It reads: <plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/>
I had this problem and made it go away by adding the following to the config.xml:
<plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/>
And adding this to the Manifest file:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
I originally took them out because I "knew" that my app wouldn't be using any communications. I had forgotten about the emulator "communicating" with the ADK.
I'll take these 2 lines out when I convert the project over to "production" so that the app is ready for Google Play.
I had this problem using phonegap 3.x and the problem turned out to be that phonegap hadn't properly installed the plugins, or they just messed up along the way. Basically when you install the plugins and build for a platform it takes the javascript files from plugins/org.apache.cordova.core.specific-plugin/www and puts them in platforms/android/assets/www/plugins/org.apache.cordova.core.specific-plugin/www and then it takes the Java files (or objective C for iOS) and puts them in platforms/android/src/org/apache/cordova/specificplugin
And all of this is specified by plugins/org.apache.cordova.core.specific-plugin/plugin.xml. If you look in a plugins.xml you should see something like:
<source-file src="src/android/NetworkManager.java" target-dir="src/org/apache/cordova/networkinformation" />
So this tells you that in platforms/android/src/org/apache/cordova/networkinformation, there should be NetworkManager.java. And right that file can be copied from plugins/org.apache.cordova.core.network-information/src/android/NetworkManager.java
Now all of this is supposed to happen automatically without having to touch the platforms folder. But if it messes up you can fix it by copying the correct java files into the correct folders.
The following line in config.xml works for cordova 6.2 with android
<plugin name="cordova-plugin-network-information" value="org.apache.cordova.networkinformation"/>
The name should be the same as in what your plugin contains. You can find it in the your project folder at the following path plugins/name-of-the-plugin/package.json.
The value should be the package name for the plugin which can be found in the native implementation file.

PhoneGap Facebook plugin connect with Android

I have a problem using the Facebook Connect plugin with PhoneGap.
I have added this line to file plugins.xml:
<plugin name="com.phonegap.facebook.Connect" value="com.phonegap.facebook.ConnectPlugin" />
And this include on in file FbDialog.java:
import com.phonegap.helloworld.R;
I have these files on src:
com
/facebook/android/
AsyncFacebookRunner.java
DialogError.java
Facebook.java
FacebookError.java
FbDialog.java
Util.java
/phonegap/
facebook/ConnectPlugin.java
helloworld/HelloPhoneGapActivity.java
The ressources files close and the icon is copied. In HTML, I include some JavaScript code:
cordova-1.6.1.js
cdv-plugin-fb-connect.js
facebook_js_sdk.js
I use the default HTML example with my appId.
When I run application on my Android phone, a dialog says:
Cordova Facebook connect plugin fail on init!
and
Cordova Facebook connect plugin fail on auth.status!
If I click the login bouton, the dialog says:
Cordova Facebook connect plugin fail on login!Class not found
And the Eclipse console log is:
I tried to install this with the officiel Git readme and the
tutorial Add Facebook login to PhoneGap/Cordova Android app Easiest way.
When I compile the application, I don't get the error.
How do I fix this problem?
After the switch to Cordova, everything got renamed. You need the new class location:
<plugin name="org.apache.cordova.facebook.Connect" value="org.apache.cordova.facebook.ConnectPlugin" />
You'll have to put your plugin java (back?) to the correct location as well in org/apache/cordova/facebook/ .
Unfortunately, the error for this is pretty vague, but you can see it if you know what to look for. You can see in your logs the line with Message=Class not found in it. It would be better if this line had the name of the class. This error happens when you call the JS for a plugin, but then the right class name can't be found in the plugins.xml file. This is also why you notice that any call fails the same way.
Verify that android studio isn't giving an error like:
A valid Facebook app id must be set in the AndroidManifest.xml or set by calling FacebookSdk.setApplicationId before initializing the sdk.
If so, then edit androidmanifest. See: A valid Facebook app id must be set in the AndroidManifest.xml

Categories

Resources