Problems using Device Plugin

13 posts, 0 answers
  1. Dan
    Dan avatar
    10 posts
    Member since:
    Sep 2013

    Posted 02 Oct 2013 Link to this post

    I am trying to add the Device Plugin using Icenium 3.0.

    Question 1 - Do I have to use the CLI to apply the plugin or can I just build the archive and 'Add' it to the project.
    Question 2 - I am using a <js-module> in plugin.xml.  Is it true I do not need a script tag in index.html?

    If so, is there an explicit step by step guide for doing this?
    list the device files in the following posts.

    Plugin Architecture

    org.apache.cordova.core.device
        src
              android
                        Device.java
             ios...
       www
             device.js
        plugin.xml
  2. Dan
    Dan avatar
    10 posts
    Member since:
    Sep 2013

    Posted 02 Oct 2013 Link to this post

    Plugin.xml

    <?xml version="1.0" encoding="UTF-8"?>

    <plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
               id="org.apache.cordova.core.device"
          version="0.1.0">
        <name>Device</name>

        <js-module src="www/device.js" name="device">
            <clobbers target="device" />
        </js-module> 

     <engines>
      <engine name="cordova" version=">=3.0.0" />
     </engines>

        <!-- android -->
        <platform name="android">
            <config-file target="res/xml/config.xml" parent="/*">
                <feature name="Device" >
                    <param name="android-package" value="org.apache.cordova.core.device"/>
                </feature>
            </config-file>

            <source-file src="src/android/Device.java" target-dir="src/org/apache/cordova/core" />
        </platform>

        <!-- ios -->
        <platform name="ios">
            <config-file target="config.xml" parent="/*">
                <feature name="Device">
                    <param name="ios-package" value="CDVDevice"/>
                </feature>
            </config-file>

            <header-file src="src/ios/CDVDevice.h" />
            <source-file src="src/ios/CDVDevice.m" />
        </platform>

        <!-- blackberry10 -->
        <platform name="blackberry10">
            <source-file src="src/blackberry10/index.js" target-dir="Device" />
            <config-file target="www/config.xml" parent="/widget">
                <feature name="Device" value="Device"/>
            </config-file>
            <config-file target="www/config.xml" parent="/widget">
                <rim:permissions>
                </rim:permissions>
            </config-file>
            <config-file target="www/config.xml" parent="/widget/rim:permissions">
                <rim:permit>read_device_identifying_information</rim:permit>
            </config-file>
        </platform>

        <!-- wp7 -->
        <platform name="wp7">
            <config-file target="config.xml" parent="/*">
                <feature name="Device">
                    <param name="wp-package" value="Device"/>
                </feature>
            </config-file>

            <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
                <Capability Name="ID_CAP_IDENTITY_DEVICE" />
            </config-file>

            <source-file src="src/wp/Device.cs" />
        </platform>

        <!-- wp8 -->
        <platform name="wp8">
            <config-file target="config.xml" parent="/*">
                <feature name="Device">
                    <param name="wp-package" value="Device"/>
                </feature>
            </config-file>

            <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
                <Capability Name="ID_CAP_IDENTITY_DEVICE" />
            </config-file>

            <source-file src="src/wp/Device.cs" />
        </platform>

    </plugin>

  3. Dan
    Dan avatar
    10 posts
    Member since:
    Sep 2013

    Posted 02 Oct 2013 Link to this post

    Plugin Architecture

    org.apache.cordova.core.device
        src
              android
                        Device.java
             ios...
       www
             device.js
        plugin.xml
  4. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 02 Oct 2013 Link to this post

    Hello Dan,

    Up to your questions:
    • Icenium doesn't have a CLI at this time. All Cordova 3.0 core plugins are directly available when you create an Icenium app. There is no need to do anything manually.
    • Yes, if you have used js-module for your js plugin files, you do not need to include reference in your html pages.

    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  5. Dan
    Dan avatar
    10 posts
    Member since:
    Sep 2013

    Posted 02 Oct 2013 Link to this post

    What about non-core plugins?  Device which I understand used to be core is now a custom plugin.

    My understanding is that I do not need to use plugin manager or CLI but can add the archive directly.
  6. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 02 Oct 2013 Link to this post

    Hello Dan,

    All APIs listed in the API reference here are considered core plugins, device included. As mentioned in previous reply, those core plugins are already at your disposal when you create an Icenium app that targets Cordova 3.0.

    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  7. Dan
    Dan avatar
    10 posts
    Member since:
    Sep 2013

    Posted 02 Oct 2013 Link to this post

    Hi Steve,

    I am totally confused by this line in the API you referenced...

    As of version 3.0, Cordova implements device-level APIs as plugins. Use the CLI's plugin command, described in The Command-line Interface, to add or remove this feature for a project:
  8. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 03 Oct 2013 Link to this post

    Hello Dan,

    Icenium applications are hybrid mobile apps utilizing Apache Cordova under the hood, but Icenium is not equal to Cordova. The instructions in the Cordova docs are aimed at users that would create a Cordova app and use their build instructions, for example: iOS Platform Guide.

    This instructions do not apply to Icenium and therefore those steps are not relevant. Again, all you need to do in order to create a hybrid app that is build with Cordova 3.0 in Icenium is to select one of our default templates. All core plugins are already added to the templates and you do not need to do anything manually to include them.

    In the next version of Icenium we would add the UI to turn them ON/OFF via switches in the app properties, should your app require only several core plugins (this would cut down app size and build time).

    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  9. Pier Alberto
    Pier Alberto avatar
    16 posts
    Member since:
    Jun 2013

    Posted 07 Oct 2013 Link to this post

    Hello Steve,

    I migrated my 2.7.0 Icenium app to Cordova 3.0.0, and I wasn't able to find any core plugins. If I simply change the target Cordova Version in the Properties window, when I run the app I get an error telling me the "notification" object is not defined, so it means that the notification plugin has not been added to the app.
    I also tried to create a new app and the core plugins seems not to be present.
    I tried to add the core plugins by importing them from the Apache repository, and then I wasn't able to build.
    So, probably I'm missing something, can you tell me how can I migrate my app to 3.0.0 in the right way?
    Thanks in advance.

    Pier Alberto
  10. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 08 Oct 2013 Link to this post

    Hello Pier,

    As mentioned in my previous replies in this thread, the only thing to do in order for the core Cordova plugins to be present in your app is to change the Cordova version to 3.0 from the app properties. I've already checked your Qu*****re app in your account and verified that this is indeed the case, both org.apache.cordova.core.dialogs and org.apache.cordova.core.vibration are present in your app's project file (you can verify that by pushing your app to a git repository and check the .proj file.

    One thing that I've noticed that is not correct is the reference to cordova.js in your index.html - it should always be the first reference on the page, jQuery, Kendo UI and other 3rd party scripts should all be after the cordova.js.

    If you're still having problems, please isolate this in a sample or provide us with steps how to reproduce this with your current app, as currently we get "Unable to contact the gateway" error when clicking the save button.

    Regards,
    Steve
    Telerik
    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  11. Pier Alberto
    Pier Alberto avatar
    16 posts
    Member since:
    Jun 2013

    Posted 08 Oct 2013 Link to this post

    Hello Steve,

    problem solved, thanks for your support.

    Pier Alberto
  12. divya
    divya avatar
    2 posts
    Member since:
    Feb 2014

    Posted 17 Feb 2014 Link to this post

    hi,
    i am working on deviceinformation for android device.i installed custom plugin path is,
    https://github.com/vliesaputra/DeviceInformationPlugin
    and i followed steps given in this blog
    http://blogs.telerik.com/appbuilder/posts/13-06-25/custom-cordova-plugins-with-icenium-and-more
    Now i am getting error is
    Uncaught ReferenceError: require is not defined in deviceinformation.js:line16.
    please help to resolve this.
  13. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 19 Feb 2014 Link to this post

    Hi divya,

    I've attached a sample project that worked on our end. The output of the plugin is console.log-ed in the Device tab.

    Regards,
    Steve
    Telerik
    Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
Back to Top