[Android Permissions Plugin] [Android Permissions Plugin] Permissions not defined

Forge Component
(5)
Published on 13 Feb by Miguel 'Kelter' Antunes
5 votes
Published on 13 Feb by Miguel 'Kelter' Antunes

I am having an issue, where android permissions plugin is never getting defined.

I am using the plugin with the IMEI Plugin, and before any code is launched, there are if statements that run the 'CheckAndroidPermissionsPlugin' function but it is always returning false.

I have tried manually checking if 

var permissions = cordova.plugins.permissions

is undefined and it always is.

I'm not sure what i have done wrong, as i am just using the basic functions within the plugin?

It is probably good to mention that i am using the native app to test this functionality, and other cordova plugins are working, so the issue isn't that cordova isn't defined, as it always passes that check.

Any help would be highly appreciated!


Here is the code within the IMEI plugin that is getting ran:

Hello Brandon,

Sorry for asking, but did you create a new package and install it in the device after including the Permissions Plugin?

Cheers.

Eduardo Jauch wrote:

Hello Brandon,

Sorry for asking, but did you create a new package and install it in the device after including the Permissions Plugin?

Cheers.

Hi Eduardo, thanks for the quick reply!


When i installed the IMEI Plugin, the permissions plugin was installed as a dependency, so both the IMEI and the android permission plugins are in their own applications/modules.

Then i added the IMEI plugin in the references in the app i am using as seen below:



EDIT:

Also, I did try building the native app again, and installing the new native app on the device after installing the plugin, however i got the same issues as before. Is that required for any new cordova plugins, as i thought that outsystems updates the native apps automatically when any code changes are published?

Solution

Hi Brandon,

Yes. Every time you add a new plugin, as it will have native code and this is not handled by the automatic update, it must be generated again and installed again in the device.

But if you already did this, it may be another type of problem...

Solution

Eduardo Jauch wrote:

Hi Brandon,

Yes. Every time you add a new plugin, as it will have native code and this is not handled by the automatic update, it must be generated again and installed again in the device.

But if you already did this, it may be another type of problem...

I'll quickly rebuild and reinstall the native app again on my phone, and see if it works...


Eduardo Jauch wrote:

Hi Brandon,

Yes. Every time you add a new plugin, as it will have native code and this is not handled by the automatic update, it must be generated again and installed again in the device.

But if you already did this, it may be another type of problem...

Hi Eduardo,

I have rebuilt the native app and the plugins are now working. I must have built the app just before i installed the new plugins, my mistake.

Thank you very much for your swift help with this matter, you're a lifesaver!


You're welcome :)
Glad it is working.