Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot make the plugin work in Phonegap app #22

Open
akadebnath opened this issue Oct 19, 2017 · 0 comments
Open

Cannot make the plugin work in Phonegap app #22

akadebnath opened this issue Oct 19, 2017 · 0 comments

Comments

@akadebnath
Copy link

Not sure why I am not able to make it work.

Here is what I have done.

Opened PhoneGap desktop app (Windows 10)
Created a new Hello World App.
Open command prompt, cd to the app directory

phonegap local plugin add https://github.com/napolitano/cordova-plugin-intent

It installed the plug in.
In plugins directory I can see this directory:

com.napolitano.cordova.plugin.intent

In config.xml I have:

<plugin name="com.napolitano.cordova.plugin.intent" spec="https://github.com/napolitano/cordova-plugin-intent" />

In AndroidManifest.xml I have:

<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https" />
            </intent-filter>
        </activity>
</application>

So, any link with https schema is giving me option to open my app. This is fine.

In index.html I have:

<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript">
document.addEventListener('deviceReady', function(){
    window.plugins.intent.getCordovaIntent(function (Intent) {
        console.log(Intent);
    }, function () {
        console.log('Error');
    });
});
</script>

In Chrome Console, I am getting this error:

Uncaught TypeError: Cannot read property 'getCordovaIntent' of undefined

So, I think the plug in is not initiated at all. Or it is something else? Whatever it is, I am struggling for two days to make it work. Please let me know what wrong I am doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant