Add phonegap/Ordova plugin

Asked

Viewed 2,130 times

3

Hey, you guys.

I’m trying to develop an APP in phonegap for Android and iOS. The goal of the APP is:

1) The person will have a button to access the device’s camera. 2) When the screen to take a photo of the device appears, you should have an image on the screen, like a target, something like that. When the person clicks to take the photo, the result has to be with this target (in the jpeg file, for example). 3) The photo appears on the screen of the APP for person see if liked... 4) .. If she likes it, she clicks a button that brings up those native sharing options on the device.

I already got (1) and (3). I copied this code: "https://gist.github.com/dhavaln/2238017"

The code is EXACTLY the same as this github link, the only thing I did was leave only one button that accesses the camera (because the access code to the images and gallery of the device, I don’t need it).

My difficulty is (and I would really like to understand this) how I add a plugin. The sharing plugin I found here: http://plugins.telerik.com/nativescript?page=1&search=camera&collection=plugins_telerik_nativescript

and the plugin itself is in: http://plugins.telerik.com/nativescript/plugin/social-share

When I use the code in the command prompt (I am using Windows7... but I will also configure in an Opensuse Tumbleweed this week) "phonegap plugin add nativescript-social-share" or the same command only with "Cordova", appears the message "Cannot find plugin.xml for plugin 'package'. Please Try Adding it Again."

Actually there is a plugin.xml file inside "/plugins/Cordova-plugin-Whitelist/" but it seems to be incompatible... I created a plugin.xml with the code taken from: https://github.com/GrumpySailor/cordova-plugin-device-rotation-vector/blob/master/plugin.xml

but unsuccessfully yet.

A lot of what I want to do and I will definitely need more in the future are "ready", I just need to add plugins. I searched several tutorials on the internet, what I liked most was: http://www.thecodebakers.org/2011/03/licao-1-praparando-o-terreno.html

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

What I did to create the project I’m trying to do this (my first!) on the command line I did "phonegap create Hellow com.eu.hello Helloworld"

It was created cute, then I did "phonegap Platform add android" and "phonegap Platform Ios" (which seems not possible in windows, but were installed files anyway)

Then I switched the css files to mine and the index.js file I took and directed to "meu_js.js". I added the camera’s HTML (first link) in html and the JS (first link too) in this "meu_js.js".

To test the APP I’m using a Motoe2, with that Phonegap app, which allows connection via "phonegap serves"

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

What do I know: I completely master HTML5, CSS3 and PHP. I have some basic understanding of Java and Python, and I’m starting to study Java.

Remembering that it is my FIRST contact with the phonegap... if possible send references where I learned to deepen also.

Thank you from now on! = D

1 answer

1


To add a plugin just use the following command:

[phonegap][cordova] plugin add <nome do plugin>

Each plugin has its own methods and objects, so it is important to check before if it offers the necessary features (and how to access them).

The social sharing plugin you specified seems to only be compatible with the Telerik platform, because there is no indication of compatibility with Cordova/Phonegap; moreover, I tried to install in Cordova and got errors, certainly the same as what happened to you.

I suggest you take a look at the site ngCordova, has a very good collection of plugins, including social sharing: http://ngcordova.com/docs/plugins/socialSharing/

  • You’re really right... I was looking at plugins for another framework. Well, I tried to install this one and it went right/wrong. It went wrong because it appears the message "Error: Path must be a string. Received false". It worked because a plugin directory appeared and the messages until android seem ok... (I’m using Windows7, work). I will try to develop the sharing later and if it works out warning you (giving your answer as solution rs)

  • It didn’t work out, didn’t... I did everything that was readme.Md and such, I followed the guidelines of Cordova and Phonegap, changing the Whitelist-plugin, but it turned out that the buttons that used to work by triggering the camera now do not work. The thing is that the "tutorials" out there say to add an excerpt of the code, but do not say in which file. They tell you to give permission and stuff, but they don’t tell you where the permits are made. For example, the meta tag with Content-Security-Policy, put what they say and stopped working everything :/

  • The codes can be in any file, either in index.html or in an external . js file, at the programmer’s discretion. As for the Content-Security-Policy tag, for now you can take it or leave it commented, it will only be used for security when publishing the app.

  • Nothing done... doesn’t work at all. :/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.