NathanaelA / nativescript-permissions

Wraps up the entire Android 6 permissions system in a easy to use plugin.
MIT License
46 stars 22 forks source link

Permissions problem on android #8

Closed mcgri closed 8 years ago

mcgri commented 8 years ago

Hi I think I have a problem with the plugin. The issue is exactly like #5 . I am using android 6.0.1 and latest version of your awesome plugin. It used to work perfectly but then i started getting the java permissions error in my main (Attempt to invoke virtual method 'int android.content.Context.checkPermission(java.lang.String, int, int)')

I created brand new test app via "tns create --ng"

My code:

`import {nativeScriptBootstrap} from "nativescript-angular/application"; import {AppComponent} from "./app.component";

var permissions = require("nativescript-permissions"); declare var android;

permissions.requestPermission(android.Manifest.permission.ACCESS_FINE_LOCATION, "I need these permissions because I'm cool") .then(function () {

nativeScriptBootstrap(AppComponent); }) .catch(function (err) { console.log(err); }); `

Manifest has the permissions...

demo\platforms\android\src\main\AndroidManifest.xml `

<uses-permission android:name="android.permission.INTERNET"/>

`

Thanks for your help

mcgri commented 8 years ago

I tried an emulator and still getting same error =(

NathanaelA commented 8 years ago

Have you try:

To reset the platforms; occasionally the platforms folder gets messed up and won't build properly; so if you reset it it fixes the issue.

In addition; have you tried the demo app; does it work?

mcgri commented 8 years ago

I re-added the platform several times before posting the issue. I suspected what something got up with it first :) I run the demo app. It works. I copied it's app code to freshly created test app and it works too.

The only difference I see , is what I am suing typescript (tns create --ng). Later today, I will debug it on my work laptop

mcgri commented 8 years ago

There something with my home PC environment. I ran exactly same code and it works on same phone. I will close the issue, but if i find out what is wrong with my home setup, then I will post it here. Might be useful to someone one day :)