Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot add cordova-plugin-uid to Visual Studio 2013 project

When trying to add https://github.com/hygieiasoft/cordova-plugin-uid to visual studio via the config.xml designer, it "recognises" there is a plugin, but ends with blank fields for all the properties (version, plugin id, etc.), even if you wait for minutes (most others find all properties in seconds). If you then try and add it, it simply crashes VS and restarts. I have tried with plugins that do not support ALL platforms, with success, but not this one.

Has anyone had any luck adding this to VS or have any ideas. Since the project is cross platform, I would prefer to use the recommended way, even though this is android only, but am open to suggestions. Ultimately, I am only looking for IMEI.

A user suggested using Telerik App Studio, as the process is simpler to copy the plugin into the www folder, but apart from the cost, I would, as noted, prefer keep within the confines of a somewhat recommended way that will continue working when upgrading to VS 2015 and beyond.

like image 525
Anthony Horne Avatar asked Apr 19 '15 09:04

Anthony Horne


1 Answers

Do the following steps -

1) Download the plugin on your windows desktop. Unzip the downloaded file.

2) Add facebookconnect.xml file to the folder where plugin.xml is present. Add your app id and application name. Place the below tags inside resources tag -

<string name="fb_app_id"></string>
<string name="fb_app_name"></string>

3) Modify the plugin.xml file to include facebookconnect.xml file. It should look like below -

    <config-file target="res/xml/config.xml" parent="/*">
        <feature name="FacebookConnectPlugin">
            <param name="android-package" value="org.apache.cordova.facebook.ConnectPlugin" />
        </feature>
        <access origin="https://m.facebook.com" />
        <access origin="https://graph.facebook.com" />
        <access origin="https://api.facebook.com" />
        <access origin="https://*.fbcdn.net" />
        <access origin="https://*.akamaihd.net" />
    </config-file>

    <source-file src="platforms/android/res/values/facebookconnect.xml" target-dir="res/values" />

    <config-file target="AndroidManifest.xml" parent="application">
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/fb_app_id"/>
        <activity android:label="@string/fb_app_name" android:name="com.facebook.LoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"></activity>
    </config-file>

    <framework src="platforms/android/FacebookLib" custom="true" />

    <!-- cordova plugin src files -->
    <source-file src="platforms/android/src/org/apache/cordova/facebook/ConnectPlugin.java" target-dir="src/org/apache/cordova/facebook" />

</platform>

4) Now Go into Visual Studio and add the plugin from the directory where plugin files are present. It will take some time to be added.

Hope this helps you fix the problem.

like image 123
user4944636 Avatar answered Nov 15 '22 04:11

user4944636