This is a migrated thread and some comments may be shown as answers.

Problems using Device Plugin

12 Answers 274 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dan
Top achievements
Rank 1
Dan asked on 02 Oct 2013, 03:33 PM
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

12 Answers, 1 is accepted

Sort by
0
Dan
Top achievements
Rank 1
answered on 02 Oct 2013, 03:34 PM

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>

0
Dan
Top achievements
Rank 1
answered on 02 Oct 2013, 03:37 PM
Plugin Architecture

org.apache.cordova.core.device
    src
          android
                    Device.java
         ios...
   www
         device.js
    plugin.xml
0
Steve
Telerik team
answered on 02 Oct 2013, 03:55 PM
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.
0
Dan
Top achievements
Rank 1
answered on 02 Oct 2013, 04:02 PM
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.
0
Steve
Telerik team
answered on 02 Oct 2013, 04:09 PM
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.
0
Dan
Top achievements
Rank 1
answered on 02 Oct 2013, 04:37 PM
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:
0
Steve
Telerik team
answered on 03 Oct 2013, 07:49 AM
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.
0
Pier Alberto
Top achievements
Rank 1
answered on 07 Oct 2013, 11:48 PM
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
0
Steve
Telerik team
answered on 08 Oct 2013, 10:46 AM
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.
0
Pier Alberto
Top achievements
Rank 1
answered on 08 Oct 2013, 09:37 PM
Hello Steve,

problem solved, thanks for your support.

Pier Alberto
0
divya
Top achievements
Rank 1
answered on 17 Feb 2014, 07:35 AM
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.
0
Steve
Telerik team
answered on 19 Feb 2014, 04:58 PM
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)
Tags
General Discussion
Asked by
Dan
Top achievements
Rank 1
Answers by
Dan
Top achievements
Rank 1
Steve
Telerik team
Pier Alberto
Top achievements
Rank 1
divya
Top achievements
Rank 1
Share this question
or