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

ionic2 how to import plugin to project? #83

Open
wzhua opened this issue Mar 22, 2017 · 6 comments
Open

ionic2 how to import plugin to project? #83

wzhua opened this issue Mar 22, 2017 · 6 comments

Comments

@wzhua
Copy link

wzhua commented Mar 22, 2017

problem is startApp is undefined.
my code :

import {
    Component
} from '@angular/core';
import {
    NavController
} from 'ionic-angular';

declare
var startApp;

@Component({
    selector: 'page-home',
    templateUrl: 'home.html'
})

export class HomePage {

    constructor(public navCtrl: NavController) {
        //console.log(startApp);
    }

    openDemo() {
        alert('xxx');
        startApp.set({
            "action": "ACTION_MAIN",
            "uri": "http://uri.amap.com/marker?position=121.287689,31.234527&name=park&src=mypage&coordinate=gaode&callnative=0",
            "intentstart": "startActivity"
        }, {}).start();
    }
}

thank you

@wuilmerj24
Copy link

@wzhua Hi, did you solve it?

@pyw-cacphy
Copy link

I also need to know. How to solve it? anyone face the same problem and got the solution?

@pavel-kurnosov
Copy link

Just add to your declarations.d.ts file declare var startApp:any; and then all will be fine.
This is just compilation error from TS.

@DanielnetoDotCom
Copy link

Still a problem here :(

@manaswinid14
Copy link

manaswinid14 commented Apr 10, 2018

var sApp = (window as any).startApp.set({
    "package": "io.myapp"
});

sApp.start();

Try this.. It works for me.

@MCDevelo
Copy link

Hi lampaa, im using this code, but it doesnt work.

facebookButton(){
this.platform.ready().then(()=>{
let appId = AllSocialApps.Facebook.android.appId;
let appStarter = (window).startApp.set({
"application": appId
}).start(function (msg) {
console.log('starting FB app: ' + msg);
}, function (err) {
console.log('FB app not installed', err);
window.open(AllSocialApps.Facebook.android.urlApp, '_system', 'locations=yes');
});
});
}

And I also try with this one
facebookButton(){
this.platform.ready().then(()=>{
let appId = AllSocialApps.Facebook.android.appId;
let appStarter = (window as any).startApp.set({
"application": appId
}).start(function (msg) {
console.log('starting FB app: ' + msg);
}, function (err) {
console.log('FB app not installed', err);
window.open(AllSocialApps.Facebook.android.urlApp, '_system', 'locations=yes');
});
});
}

And then it dosent work, i just take this error
Error: Uncaught (en promesa): TypeError: No se puede leer la propiedad 'set' de TypeError indefinido: No se puede leer la propiedad 'set' de undefined en http: // localhost: 8100 / build / main.js: 519: 46 en t.invoke (http: // localhost: 8100 / build / polyfills.js: 3: 14976) en Object.onInvoke (http: // localhost: 8100 / build / vendor.js: 5134: 33) en t.invoke (http: / /localhost:8100/build/polyfills.js:3:14916) en r.run (http: // localhost: 8100 / build / polyfills.js: 3: 10143) en http: // localhost: 8100 / build / polyfills .js: 3: 20242 en t.invokeTask (http: // localhost: 8100 / build / polyfills.js: 3: 15660) en Object.onInvokeTask (http: // localhost: 8100 / build / vendor.js: 5125: 33) en t.invokeTask (http: // localhost: 8100 / build / polyfills.js: 3: 15581) en r.runTask (http: // localhost: 8100 / build / polyfills.js: 3: 10834) en c (http: // localhost: 8100 / build / polyfills.js:3: 19752) en http: // localhost: 8100 / build / polyfills.js: 3: 20273 en t.invokeTask (http: // localhost: 8100 / build / polyfills.js: 3: 15660) en Object.onInvokeTask ( http: // localhost: 8100 / build / vendor.js: 5125: 33) en t.invokeTask (http: // localhost: 8100 / build / polyfills.js: 3: 15581) en r.runTask (http: // localhost: 8100 / build / polyfills.js: 3: 10834) en o (http: // localhost: 8100 / build / polyfills.js: 3: 7894) en e.invokeTask [como invocar] (http: // localhost: 8100 / build / polyfills.js: 3: 16823) en p (http: // localhost: 8100 / build / polyfills.js: 2: 27648) en HTMLImageElement.v (http: // localhost: 8100 / build / polyfills. JS: 2: 27893)invokeTask (http: // localhost: 8100 / build / polyfills.js: 3: 15581) en r.runTask (http: // localhost: 8100 / build / polyfills.js: 3: 10834) en o (http: // localhost: 8100 / build / polyfills.js: 3: 7894) en e.invokeTask [como invocación] (http: // localhost: 8100 / build / polyfills.js: 3: 16823) en p (http: // localhost: 8100 / build / polyfills.js: 2: 27648) en HTMLImageElement.v (http: // localhost: 8100 / build / polyfills.js: 2: 27893)invokeTask (http: // localhost: 8100 / build / polyfills.js: 3: 15581) en r.runTask (http: // localhost: 8100 / build / polyfills.js: 3: 10834) en o (http: // localhost: 8100 / build / polyfills.js: 3: 7894) en e.invokeTask [como invocación] (http: // localhost: 8100 / build / polyfills.js: 3: 16823) en p (http: // localhost: 8100 / build / polyfills.js: 2: 27648) en HTMLImageElement.v (http: // localhost: 8100 / build / polyfills.js: 2: 27893).

Please help me Im using ionic 3..

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

No branches or pull requests

8 participants