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 read property 'startActivity' of undefined #14

Open
map7 opened this issue Jun 18, 2020 · 3 comments
Open

Cannot read property 'startActivity' of undefined #14

map7 opened this issue Jun 18, 2020 · 3 comments

Comments

@map7
Copy link

map7 commented Jun 18, 2020

I get the following error when trying to share a PDF and the same kind of error when using some of the demo code in my app.

application.android.currentContext.startActivity(android.content.Intent.createChooser(intent, args.intentTitle ? args.intentTitle : 'Open file:'));
VM120:1 Uncaught TypeError: Cannot read property 'startActivity' of undefined
    at eval (eval at push.../node_modules/nativescript-share-file/share-file.js.ShareFile.open (share-file.js:26), <anonymous>:1:36)
    at ShareFile.push.../node_modules/nativescript-share-file/share-file.js.ShareFile.open (share-file.js:26)
    at PdfService.push../app/services/pdf.service.ts.PdfService.share_pdf (pdf.service.ts:49)
    at AssetComponent.push../app/assets/asset.component.ts.AssetComponent.sharePdf (asset.component.ts:108)
    at Object.eval [as handleEvent] (AssetComponent.html:22)
    at handleEvent (core.js:29239)
    at callWithDebugContext (core.js:30309)
    at Object.debugHandleEvent [as handleEvent] (core.js:30036)
    at dispatchEvent (core.js:19859)
    at core.js:28448
    at renderer.js:241
    at ZoneDelegate.push.../node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js.ZoneDelegate.invoke (zone-nativescript.js:388)
    at Object.onInvoke (core.js:26256)
    at ZoneDelegate.push.../node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js.ZoneDelegate.invoke (zone-nativescript.js:387)
    at Zone.push.../node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js.Zone.run (zone-nativescript.js:138)
@felixelgato92
Copy link

The PR by interrobrian also fixes this issue. It does require additional changes to the AndroidManifest adding a fileProvider, but it an easy fix: #15

@ray007
Copy link

ray007 commented Nov 19, 2020

I have only Android 9 here on my test phone, but I'm getting the same error.
Maybe something to do with Nativescript 7.x?

@Leon-Bor
Copy link
Collaborator

Leon-Bor commented Jan 12, 2022

@baltruschat if you like you can give me access rights to this repo, so I can maintain it again. Currently it has more forks than star, so it is still getting used and it looks like you have other things to do :)

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

4 participants