Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] android – How to achieve ionic permissions on first load

Posted on November 11, 2022 By

Solution 1 :

This is not possible or preferable. The new permissions paradigm is to request permissions when needed (‘in context’). This way, the user should be in no doubt as to why you are requesting permission.

From the Android documentation:

Ask for permissions in context, when the user starts to interact with the feature that requires it.

iOS shares this idea:

Request personal data only when your app clearly needs it.

Problem :

My app currently asks for permissions when users open activities, I would like to have those permissions on app first load.

Example

One of my components (activity) needs callNumber permission and asking for this permission won’t be popup until user opens that component, I would like to have that permission popup when user install the app for first time instead of when user goes to that specific activity.

Code

MyComponent.ts (my custom component activity that calling happen in that page)

import { CallNumber } from '@ionic-native/call-number/ngx';

constructor(
    private callNumber: CallNumber,
) {...}

callEmergencies(event: any) {
    this.callNumber.callNumber(event, true)
    .then(res => {
        Toast.show({
        text: 'Calling ' + res + ' ...'
        });
    })
    .catch(err => {
        Toast.show({
        text: 'something went wrong.'
        });
    });
}

App.module.ts (main module)

import { CallNumber } from '@ionic-native/call-number/ngx';

providers: [
    CallNumber,
],

app.component.ts (Main component)

Has nothing about CallNumber plugin.

Question

How can I achieve that logic (asking permissions on first launch instead of in each activity)?

READ  [FIXED] android - How to pass Search Bar input as props to another screen in react navigation?
Powered by Inline Related Posts
Android Tags:android, angular, ionic-framework

Post navigation

Previous Post: [FIXED] java – How can I solve this Android Studio Firebase problem?
Next Post: [FIXED] Android Java Publish result cast issue at MyCustomAdapter.java

Related Posts

[FIXED] android studio – Problem with new installation of Flutter windows 10 Android
[FIXED] Which components of Android to use? Android
[FIXED] flutter – FIREBASE_MESSAGING: onBackgroundMessage not handling notification when app is on Background or Terminated Android
[FIXED] android – How do you customize default behaviour of search dialog? Android
[FIXED] Android Studio have you declared this activity in your AndroidManifest.xml? Android
[FIXED] android – how to send and receive data from nodemcu? Android

Archives

  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • Can Vicks humidifier be used without filter?
  • What color is Spanish green?
  • How old is Jamie in The War That Saved My Life?
  • When should I use scalp massager for hair growth?
  • Can I put polyurethane over liming wax?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme