How to check erros in my Ionic 4 project? The 2019 Stack Overflow Developer Survey Results Are InHow do you explicitly set a new property on `window` in TypeScript?Is there a dedicated function to check null and undefined in TypeScript?How can I select an element in a component template?How can I get new selection in “select” in Angular 2?Expression ___ has changed after it was checkedHow to use Bootstrap in an Angular project?Huge number of files generated for every Angular projectHybrid App - Ionic vs NativeScriptHow to use Ionic native - MS Adal in ionic project?Ionic 3- How to check if event parameter exists?

What does Linus Torvalds mean when he says that Git "never ever" tracks a file?

How do I free up internal storage if I don't have any apps downloaded?

What do I do when my TA workload is more than expected?

How to type a long/em dash `—`

Is it a good practice to use a static variable in a Test Class and use that in the actual class instead of Test.isRunningTest()?

Button changing its text & action. Good or terrible?

How to charge AirPods to keep battery healthy?

Can I have a signal generator on while it's not connected?

Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?

How do you keep chess fun when your opponent constantly beats you?

Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?

Are there any other methods to apply to solving simultaneous equations?

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

Inverse Relationship Between Precision and Recall

Why was M87 targeted for the Event Horizon Telescope instead of Sagittarius A*?

Old scifi movie from the 50s or 60s with men in solid red uniforms who interrogate a spy from the past

How can I define good in a religion that claims no moral authority?

The difference between dialogue marks

Is it okay to consider publishing in my first year of PhD?

Getting crown tickets for Statue of Liberty

Can an undergraduate be advised by a professor who is very far away?

Straighten subgroup lattice

How to notate time signature switching consistently every measure

What do hard-Brexiteers want with respect to the Irish border?



How to check erros in my Ionic 4 project?



The 2019 Stack Overflow Developer Survey Results Are InHow do you explicitly set a new property on `window` in TypeScript?Is there a dedicated function to check null and undefined in TypeScript?How can I select an element in a component template?How can I get new selection in “select” in Angular 2?Expression ___ has changed after it was checkedHow to use Bootstrap in an Angular project?Huge number of files generated for every Angular projectHybrid App - Ionic vs NativeScriptHow to use Ionic native - MS Adal in ionic project?Ionic 3- How to check if event parameter exists?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm developing an App (Using Ionic 4, Angular, Typescript) that records Audios and play afterwards. For some reason when I test on the device, after the user allow the app to use Local Storage and the Mic, it chrashes with no erros.
Is there an way to have a Log of what is going on? I'll leave my .html and .ts files.



audios.page.html



 <ion-row>
<ion-col>
<ion-button expand="full" (click)="capturarAudio()">Gravar áudio</ion-button>
</ion-col>
</ion-row>

<ion-list>

<ion-item *ngFor="let arquivo of mediaFiles" tappable (click)="play(arquivo)" text-wrap>
file.name
<p> number MB </p>
</ion-item>
</ion-list>


audios.page.ts



 import Component, OnInit from '@angular/core';
import MediaCapture from '@ionic-native/media-capture/ngx';
import IonicStorageModule from '@ionic/storage';
import Media, MediaObject from '@ionic-native/media/ngx';
import File from '@ionic-native/file/ngx';
import Storage from '@ionic/storage';

const MEDIA_FILES_KEY = 'mediafiles';

@Component(
selector: 'app-audios',
templateUrl: './audios.page.html',
styleUrls: ['./audios.page.scss'],
)
export class AudiosPage implements OnInit

mediaFiles = [];
constructor(private mediaCapture: MediaCapture, private storage: Storage, private media: Media, private file: File)




ionViewDidLoad()

this.storage.get(MEDIA_FILES_KEY).then(res => [];
);


capturarAudio()
this.mediaCapture.captureAudio().then( res =>
this.storeMediaFiles(res);
)


play(myFile)
console.log('play', myFile);
if (myFile.name.indexOf('.wav') > -1)
const audioFile: MediaObject = this.media.create(myFile.localURL)
audioFile.play();



storeMediaFiles(files)
console.log('storage:', files);
this.storage.get(MEDIA_FILES_KEY).then(res =>
if (res)
let arr = JSON.parse(res);
arr = arr.concat(files);
this.storage.set(MEDIA_FILES_KEY, JSON.stringify(arr))
else
this.storage.set(MEDIA_FILES_KEY, JSON.stringify(files))

this.mediaFiles = this.mediaFiles.concat(files);
)



ngOnInit()





EDIT1: With Logcat I get this error:



E/PluginManager: Uncaught exception from plugin
android.content.ActivityNotFoundException: No Activity found to handle Intent act=android.provider.MediaStore.RECORD_SOUND
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1899)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1589)
at android.app.Activity.startActivityForResult(Activity.java:4229)
at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:343)
at android.app.Activity.startActivityForResult(Activity.java:4187)
at org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(CordovaInterfaceImpl.java:68)
at org.apache.cordova.mediacapture.Capture.captureAudio(Capture.java:234)
at org.apache.cordova.mediacapture.Capture.execute(Capture.java:132)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)









share|improve this question
























  • Welcome to Stack Overflow! What kind of device are you testing on? For Android you could use Logcat to get more details. For iOS you could use XCode to see more details.

    – Mathyn
    Mar 8 at 11:08











  • I'm testing on my Moto X Play, I'll try on Android Studio with Logcat

    – rzp
    Mar 8 at 11:15











  • Here is solution: medium.com/@coderonfleek/…

    – mumair
    Mar 8 at 13:28

















0















I'm developing an App (Using Ionic 4, Angular, Typescript) that records Audios and play afterwards. For some reason when I test on the device, after the user allow the app to use Local Storage and the Mic, it chrashes with no erros.
Is there an way to have a Log of what is going on? I'll leave my .html and .ts files.



audios.page.html



 <ion-row>
<ion-col>
<ion-button expand="full" (click)="capturarAudio()">Gravar áudio</ion-button>
</ion-col>
</ion-row>

<ion-list>

<ion-item *ngFor="let arquivo of mediaFiles" tappable (click)="play(arquivo)" text-wrap>
file.name
<p> number MB </p>
</ion-item>
</ion-list>


audios.page.ts



 import Component, OnInit from '@angular/core';
import MediaCapture from '@ionic-native/media-capture/ngx';
import IonicStorageModule from '@ionic/storage';
import Media, MediaObject from '@ionic-native/media/ngx';
import File from '@ionic-native/file/ngx';
import Storage from '@ionic/storage';

const MEDIA_FILES_KEY = 'mediafiles';

@Component(
selector: 'app-audios',
templateUrl: './audios.page.html',
styleUrls: ['./audios.page.scss'],
)
export class AudiosPage implements OnInit

mediaFiles = [];
constructor(private mediaCapture: MediaCapture, private storage: Storage, private media: Media, private file: File)




ionViewDidLoad()

this.storage.get(MEDIA_FILES_KEY).then(res => [];
);


capturarAudio()
this.mediaCapture.captureAudio().then( res =>
this.storeMediaFiles(res);
)


play(myFile)
console.log('play', myFile);
if (myFile.name.indexOf('.wav') > -1)
const audioFile: MediaObject = this.media.create(myFile.localURL)
audioFile.play();



storeMediaFiles(files)
console.log('storage:', files);
this.storage.get(MEDIA_FILES_KEY).then(res =>
if (res)
let arr = JSON.parse(res);
arr = arr.concat(files);
this.storage.set(MEDIA_FILES_KEY, JSON.stringify(arr))
else
this.storage.set(MEDIA_FILES_KEY, JSON.stringify(files))

this.mediaFiles = this.mediaFiles.concat(files);
)



ngOnInit()





EDIT1: With Logcat I get this error:



E/PluginManager: Uncaught exception from plugin
android.content.ActivityNotFoundException: No Activity found to handle Intent act=android.provider.MediaStore.RECORD_SOUND
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1899)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1589)
at android.app.Activity.startActivityForResult(Activity.java:4229)
at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:343)
at android.app.Activity.startActivityForResult(Activity.java:4187)
at org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(CordovaInterfaceImpl.java:68)
at org.apache.cordova.mediacapture.Capture.captureAudio(Capture.java:234)
at org.apache.cordova.mediacapture.Capture.execute(Capture.java:132)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)









share|improve this question
























  • Welcome to Stack Overflow! What kind of device are you testing on? For Android you could use Logcat to get more details. For iOS you could use XCode to see more details.

    – Mathyn
    Mar 8 at 11:08











  • I'm testing on my Moto X Play, I'll try on Android Studio with Logcat

    – rzp
    Mar 8 at 11:15











  • Here is solution: medium.com/@coderonfleek/…

    – mumair
    Mar 8 at 13:28













0












0








0








I'm developing an App (Using Ionic 4, Angular, Typescript) that records Audios and play afterwards. For some reason when I test on the device, after the user allow the app to use Local Storage and the Mic, it chrashes with no erros.
Is there an way to have a Log of what is going on? I'll leave my .html and .ts files.



audios.page.html



 <ion-row>
<ion-col>
<ion-button expand="full" (click)="capturarAudio()">Gravar áudio</ion-button>
</ion-col>
</ion-row>

<ion-list>

<ion-item *ngFor="let arquivo of mediaFiles" tappable (click)="play(arquivo)" text-wrap>
file.name
<p> number MB </p>
</ion-item>
</ion-list>


audios.page.ts



 import Component, OnInit from '@angular/core';
import MediaCapture from '@ionic-native/media-capture/ngx';
import IonicStorageModule from '@ionic/storage';
import Media, MediaObject from '@ionic-native/media/ngx';
import File from '@ionic-native/file/ngx';
import Storage from '@ionic/storage';

const MEDIA_FILES_KEY = 'mediafiles';

@Component(
selector: 'app-audios',
templateUrl: './audios.page.html',
styleUrls: ['./audios.page.scss'],
)
export class AudiosPage implements OnInit

mediaFiles = [];
constructor(private mediaCapture: MediaCapture, private storage: Storage, private media: Media, private file: File)




ionViewDidLoad()

this.storage.get(MEDIA_FILES_KEY).then(res => [];
);


capturarAudio()
this.mediaCapture.captureAudio().then( res =>
this.storeMediaFiles(res);
)


play(myFile)
console.log('play', myFile);
if (myFile.name.indexOf('.wav') > -1)
const audioFile: MediaObject = this.media.create(myFile.localURL)
audioFile.play();



storeMediaFiles(files)
console.log('storage:', files);
this.storage.get(MEDIA_FILES_KEY).then(res =>
if (res)
let arr = JSON.parse(res);
arr = arr.concat(files);
this.storage.set(MEDIA_FILES_KEY, JSON.stringify(arr))
else
this.storage.set(MEDIA_FILES_KEY, JSON.stringify(files))

this.mediaFiles = this.mediaFiles.concat(files);
)



ngOnInit()





EDIT1: With Logcat I get this error:



E/PluginManager: Uncaught exception from plugin
android.content.ActivityNotFoundException: No Activity found to handle Intent act=android.provider.MediaStore.RECORD_SOUND
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1899)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1589)
at android.app.Activity.startActivityForResult(Activity.java:4229)
at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:343)
at android.app.Activity.startActivityForResult(Activity.java:4187)
at org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(CordovaInterfaceImpl.java:68)
at org.apache.cordova.mediacapture.Capture.captureAudio(Capture.java:234)
at org.apache.cordova.mediacapture.Capture.execute(Capture.java:132)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)









share|improve this question
















I'm developing an App (Using Ionic 4, Angular, Typescript) that records Audios and play afterwards. For some reason when I test on the device, after the user allow the app to use Local Storage and the Mic, it chrashes with no erros.
Is there an way to have a Log of what is going on? I'll leave my .html and .ts files.



audios.page.html



 <ion-row>
<ion-col>
<ion-button expand="full" (click)="capturarAudio()">Gravar áudio</ion-button>
</ion-col>
</ion-row>

<ion-list>

<ion-item *ngFor="let arquivo of mediaFiles" tappable (click)="play(arquivo)" text-wrap>
file.name
<p> number MB </p>
</ion-item>
</ion-list>


audios.page.ts



 import Component, OnInit from '@angular/core';
import MediaCapture from '@ionic-native/media-capture/ngx';
import IonicStorageModule from '@ionic/storage';
import Media, MediaObject from '@ionic-native/media/ngx';
import File from '@ionic-native/file/ngx';
import Storage from '@ionic/storage';

const MEDIA_FILES_KEY = 'mediafiles';

@Component(
selector: 'app-audios',
templateUrl: './audios.page.html',
styleUrls: ['./audios.page.scss'],
)
export class AudiosPage implements OnInit

mediaFiles = [];
constructor(private mediaCapture: MediaCapture, private storage: Storage, private media: Media, private file: File)




ionViewDidLoad()

this.storage.get(MEDIA_FILES_KEY).then(res => [];
);


capturarAudio()
this.mediaCapture.captureAudio().then( res =>
this.storeMediaFiles(res);
)


play(myFile)
console.log('play', myFile);
if (myFile.name.indexOf('.wav') > -1)
const audioFile: MediaObject = this.media.create(myFile.localURL)
audioFile.play();



storeMediaFiles(files)
console.log('storage:', files);
this.storage.get(MEDIA_FILES_KEY).then(res =>
if (res)
let arr = JSON.parse(res);
arr = arr.concat(files);
this.storage.set(MEDIA_FILES_KEY, JSON.stringify(arr))
else
this.storage.set(MEDIA_FILES_KEY, JSON.stringify(files))

this.mediaFiles = this.mediaFiles.concat(files);
)



ngOnInit()





EDIT1: With Logcat I get this error:



E/PluginManager: Uncaught exception from plugin
android.content.ActivityNotFoundException: No Activity found to handle Intent act=android.provider.MediaStore.RECORD_SOUND
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1899)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1589)
at android.app.Activity.startActivityForResult(Activity.java:4229)
at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:343)
at android.app.Activity.startActivityForResult(Activity.java:4187)
at org.apache.cordova.CordovaInterfaceImpl.startActivityForResult(CordovaInterfaceImpl.java:68)
at org.apache.cordova.mediacapture.Capture.captureAudio(Capture.java:234)
at org.apache.cordova.mediacapture.Capture.execute(Capture.java:132)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)






angular typescript ionic-framework






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 13:15









Mathyn

7401024




7401024










asked Mar 8 at 11:02









rzprzp

146




146












  • Welcome to Stack Overflow! What kind of device are you testing on? For Android you could use Logcat to get more details. For iOS you could use XCode to see more details.

    – Mathyn
    Mar 8 at 11:08











  • I'm testing on my Moto X Play, I'll try on Android Studio with Logcat

    – rzp
    Mar 8 at 11:15











  • Here is solution: medium.com/@coderonfleek/…

    – mumair
    Mar 8 at 13:28

















  • Welcome to Stack Overflow! What kind of device are you testing on? For Android you could use Logcat to get more details. For iOS you could use XCode to see more details.

    – Mathyn
    Mar 8 at 11:08











  • I'm testing on my Moto X Play, I'll try on Android Studio with Logcat

    – rzp
    Mar 8 at 11:15











  • Here is solution: medium.com/@coderonfleek/…

    – mumair
    Mar 8 at 13:28
















Welcome to Stack Overflow! What kind of device are you testing on? For Android you could use Logcat to get more details. For iOS you could use XCode to see more details.

– Mathyn
Mar 8 at 11:08





Welcome to Stack Overflow! What kind of device are you testing on? For Android you could use Logcat to get more details. For iOS you could use XCode to see more details.

– Mathyn
Mar 8 at 11:08













I'm testing on my Moto X Play, I'll try on Android Studio with Logcat

– rzp
Mar 8 at 11:15





I'm testing on my Moto X Play, I'll try on Android Studio with Logcat

– rzp
Mar 8 at 11:15













Here is solution: medium.com/@coderonfleek/…

– mumair
Mar 8 at 13:28





Here is solution: medium.com/@coderonfleek/…

– mumair
Mar 8 at 13:28












1 Answer
1






active

oldest

votes


















0














If you have a look at the documentation for Android permissions you will find the following steps.



To find the permissions you require, have a look here. You then use that in the below code. The android permissions has to be called right before you use that resource since Android API >=26.




Installation



Run the following in your console:



ionic cordova plugin add cordova-plugin-android-permissions
npm install @ionic-native/android-permissions



Usage



import AndroidPermissions from '@ionic-native/android-permissions/ngx';


constructor(private androidPermissions: AndroidPermissions)

...

this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
result => console.log('Has permission?',result.hasPermission),
err => this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA)
);

this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]);





share|improve this answer























  • But this is just for Camera permission, right? I'm not trying to use the camera.

    – rzp
    Mar 11 at 12:43











  • Look at the second link in my answer called here it has all the permissions that you can request. There are too many to post here that is why I linked to it.

    – Tachyon
    Mar 11 at 12:47











  • Worked, thanks.

    – rzp
    Mar 11 at 14:42











  • No problem, glad I could help!

    – Tachyon
    Mar 11 at 14:44











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061859%2fhow-to-check-erros-in-my-ionic-4-project%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














If you have a look at the documentation for Android permissions you will find the following steps.



To find the permissions you require, have a look here. You then use that in the below code. The android permissions has to be called right before you use that resource since Android API >=26.




Installation



Run the following in your console:



ionic cordova plugin add cordova-plugin-android-permissions
npm install @ionic-native/android-permissions



Usage



import AndroidPermissions from '@ionic-native/android-permissions/ngx';


constructor(private androidPermissions: AndroidPermissions)

...

this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
result => console.log('Has permission?',result.hasPermission),
err => this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA)
);

this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]);





share|improve this answer























  • But this is just for Camera permission, right? I'm not trying to use the camera.

    – rzp
    Mar 11 at 12:43











  • Look at the second link in my answer called here it has all the permissions that you can request. There are too many to post here that is why I linked to it.

    – Tachyon
    Mar 11 at 12:47











  • Worked, thanks.

    – rzp
    Mar 11 at 14:42











  • No problem, glad I could help!

    – Tachyon
    Mar 11 at 14:44















0














If you have a look at the documentation for Android permissions you will find the following steps.



To find the permissions you require, have a look here. You then use that in the below code. The android permissions has to be called right before you use that resource since Android API >=26.




Installation



Run the following in your console:



ionic cordova plugin add cordova-plugin-android-permissions
npm install @ionic-native/android-permissions



Usage



import AndroidPermissions from '@ionic-native/android-permissions/ngx';


constructor(private androidPermissions: AndroidPermissions)

...

this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
result => console.log('Has permission?',result.hasPermission),
err => this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA)
);

this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]);





share|improve this answer























  • But this is just for Camera permission, right? I'm not trying to use the camera.

    – rzp
    Mar 11 at 12:43











  • Look at the second link in my answer called here it has all the permissions that you can request. There are too many to post here that is why I linked to it.

    – Tachyon
    Mar 11 at 12:47











  • Worked, thanks.

    – rzp
    Mar 11 at 14:42











  • No problem, glad I could help!

    – Tachyon
    Mar 11 at 14:44













0












0








0







If you have a look at the documentation for Android permissions you will find the following steps.



To find the permissions you require, have a look here. You then use that in the below code. The android permissions has to be called right before you use that resource since Android API >=26.




Installation



Run the following in your console:



ionic cordova plugin add cordova-plugin-android-permissions
npm install @ionic-native/android-permissions



Usage



import AndroidPermissions from '@ionic-native/android-permissions/ngx';


constructor(private androidPermissions: AndroidPermissions)

...

this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
result => console.log('Has permission?',result.hasPermission),
err => this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA)
);

this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]);





share|improve this answer













If you have a look at the documentation for Android permissions you will find the following steps.



To find the permissions you require, have a look here. You then use that in the below code. The android permissions has to be called right before you use that resource since Android API >=26.




Installation



Run the following in your console:



ionic cordova plugin add cordova-plugin-android-permissions
npm install @ionic-native/android-permissions



Usage



import AndroidPermissions from '@ionic-native/android-permissions/ngx';


constructor(private androidPermissions: AndroidPermissions)

...

this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
result => console.log('Has permission?',result.hasPermission),
err => this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA)
);

this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]);






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 8 at 12:53









TachyonTachyon

787515




787515












  • But this is just for Camera permission, right? I'm not trying to use the camera.

    – rzp
    Mar 11 at 12:43











  • Look at the second link in my answer called here it has all the permissions that you can request. There are too many to post here that is why I linked to it.

    – Tachyon
    Mar 11 at 12:47











  • Worked, thanks.

    – rzp
    Mar 11 at 14:42











  • No problem, glad I could help!

    – Tachyon
    Mar 11 at 14:44

















  • But this is just for Camera permission, right? I'm not trying to use the camera.

    – rzp
    Mar 11 at 12:43











  • Look at the second link in my answer called here it has all the permissions that you can request. There are too many to post here that is why I linked to it.

    – Tachyon
    Mar 11 at 12:47











  • Worked, thanks.

    – rzp
    Mar 11 at 14:42











  • No problem, glad I could help!

    – Tachyon
    Mar 11 at 14:44
















But this is just for Camera permission, right? I'm not trying to use the camera.

– rzp
Mar 11 at 12:43





But this is just for Camera permission, right? I'm not trying to use the camera.

– rzp
Mar 11 at 12:43













Look at the second link in my answer called here it has all the permissions that you can request. There are too many to post here that is why I linked to it.

– Tachyon
Mar 11 at 12:47





Look at the second link in my answer called here it has all the permissions that you can request. There are too many to post here that is why I linked to it.

– Tachyon
Mar 11 at 12:47













Worked, thanks.

– rzp
Mar 11 at 14:42





Worked, thanks.

– rzp
Mar 11 at 14:42













No problem, glad I could help!

– Tachyon
Mar 11 at 14:44





No problem, glad I could help!

– Tachyon
Mar 11 at 14:44



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061859%2fhow-to-check-erros-in-my-ionic-4-project%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved