Quantcast
Channel: Ionic Forum - Latest posts
Viewing all 231638 articles
Browse latest View live

Querystring support in ion-router (with StencilJs)

$
0
0

I have a StencilJS app with Ionic web components using the following routing setup:

<ion-router useHash={false}>
  <ion-route url="/home" component="page-home"/>
  <ion-route url="/login" component="page-login"/>
  <ion-route url="/main" component="page-main">
</ion-router>

When I receive a 401 error from the api, I would like to redirect to the login page, with the current url as a redirect querystring parameter (in order to redirect the user back to where he came from), like so:

const navCtrl: HTMLIonRouterElement = document.querySelector("ion-router");
fetch('https://someapi.com/users/1').then(
  res => navCtrl.push('/main'),
  err => navCtrl.push(`/login?redirect=${window.location.pathname}`)
);

When I do this an I receive an error from the api, and I want to navigate to the login page with the current route as querystring parameter, Stencil throws the following error: [ion-router] the path does not match any route.

How can I use the querystring with the ion-router?


IONIC 4 Firebase analytics multiple environment/project

Do I need backend for native app?

$
0
0

Hi guys, I am building my project and I wanted to add simple function send.messege() using gmail API. But I found that I can’t use Gmail API in my angular and I need to use backend server for that (node.js). The whole idea is that you click button and function execute and sends message ‘Hello World’ to gmail user.
Please direct me, I am really struggling with it.

Gmail API in Ionic 2

$
0
0

Hi, I am trying to do same thing, did you find solution?

Cannot find module '@ionic-native/Camera/ngx

$
0
0

sorry for being noob, the answer to my question was just to change the import line @ionic-native/Camera/ngx to @ionic-native/camera/ngx.

What is your development setup?

$
0
0

I’m using Ionic with Angular to write an iOS and Android app.
But most of the development I use ionic serve with Chrome, it’s fast and simple.

But now I realized that it’s getting harder when I have to use the native HTTP API to do fundamental things like talking to a rest api on my server. The native HTTP api is working for the iOS/Android app in production, but not in the web app mode I’m using for development.

I know that I there are options like live reload for iOS and Android but they are still lazy in my point of view.

So I’m asking you:
Do you prefer developing directly with iOS/Android emulator/devices or are you also using the web app and found a way around the troubles above?

Waterfront

Ionic Http appending header

Do I need backend for native app?

$
0
0

Hi Roben,

You could use Firebase, which provides Cloud Functions which can be written in Node.js to connect to the Gmail API. There are a lot of tutorials online to help you setup a Firebase project (as backend) such as this medium post. You can create a Cloud Function that listens to a certain https url, to which you can send a HTTP request.

The only thing you have to do in your app is creating this http request, this is covered in the documentation of Angular.

I hope you succeed with the provided information :smile:


Do I need backend for native app?

What is your development setup?

$
0
0

For a complex app i use a service that derermines if it runs in browser, then use Angulars HttpClient and if it runs on device it uses native HTTP (because i need ssl pinning).

If i dont use SSL Pinning i only use Angulars HttpClient.

But in general i start developing on browser, but switch to devices really fast. Design Changes or designing new pages i do in browser too mostly because i can check the responsiveness best

What is your development setup?

$
0
0

I often use mock backends built into the app that bypass HTTP entirely and instead return Observables of curated toy business layer data for the initial phase of development. This allows me to put off setting up an entire backend and middleware stack for a while.

Backing up project Advice

$
0
0

There should be a default .gitignore at the top level of your project folder that does a decent job of dealing with this.

Compile stuck bug IonMenuToggle wrap withRouter

$
0
0
const Page: React.FC = () => {

  const location = useLocation();
  const { name } = useParams<{ name: string; }>();

  const renderMenu = () => {
    if (location.pathname === "/page/Inbox") {
      return null
    } else {
      return <IonMenuButton />
    }
  }

  return (
    <IonPage>
      <IonHeader>
        <IonToolbar>
          <IonButtons slot="start">
            {renderMenu()}
          </IonButtons>
          <IonTitle>{name}</IonTitle>
        </IonToolbar>
      </IonHeader>

      <IonContent>
        <IonHeader collapse="condense">
          <IonToolbar>
            <IonTitle size="large">{name}</IonTitle>
          </IonToolbar>
        </IonHeader>
        <ExploreContainer name={name} />
      </IonContent>
    </IonPage>
  );
};

export default Page;
const Menu: React.FC = () => {
  const location = useLocation();

  console.log(location.pathname);

  if (location.pathname === "/page/Inbox") return null;
  
  return (
    <IonMenu contentId="main" type="overlay">
    ... rest of code
  );
};

export default Menu;

Appflow ignores strings from config.xml (Bluetooth Usage Description)

$
0
0

Appflow has suddenly stopped including the bluetooth usage description in the info.plist file of the resulting ipa.

My Cordova config.xml includes these lines:

<config-file overwrite = "true" parent = "NSBluetoothAlwaysUsageDescription" platform = "ios" target = "* - Info.plist">
          <string> This app would like to access Bluetooth to use the remote control. </string>
      </config-file>
      <config-file overwrite = "true" parent = "NSBluetoothPeripheralUsageDescription" platform = "ios" target = "* - Info.plist">
          <string> This app would like to access Bluetooth to use the remote control. </string>
      </config-file>

Until 2 days ago my commits were built without problems, the resulting ipas include the strings in the info.plist however now, even building the commits prior to this Appflow bug, the resulting ipas have ignored the strings:

	<key>NSBluetoothAlwaysUsageDescription</key>
	<string></string>
	<key>NSBluetoothPeripheralUsageDescription</key>
	<string></string>

My ipa is rejected by Apple, since Apple requires a usage description for bluetooth. Apple Store Connect now says:
ITMS-90683: Missing Purpose String in Info.plist

Any ideas how to solve this? Thank you
NOTE: unzipping the ipa and editing the info.plist to include the string is not a solution, the ipa will not be installed after modifying the info.plist

Appflow ignores strings from config.xml (Bluetooth Usage Description)

$
0
0

Appflow is a payed System isn’t it? You should use you support you have then.


Ionic Modal is not passing data back

$
0
0

The problem is that data being sent back from modal is undefined.

The function I’m using to open my modal is below:

async openResultsModal() {

  this.ResultsPopover = await this.modalController.create({

    component: ResultsPage,

    componentProps: {

      gameMode: this.gameMode,

      Localresult: this.LocalGameResult

    },

    mode: "ios"

  });

  this.ResultsPopover.onDidDismiss().then((dataReturned) => {

   if (dataReturned !== null) {

    console.log(dataReturned.data);

  }

  });

  return await this.ResultsPopover.present();

}

However, This function is inside a service file and I am calling it in a timer like so:
The timer will need to stay

  setTimeout(() => 
  {
      this.openResultsModal();
  },
  1500);

My modal page is like this:

export class ResultsPage implements OnInit {
  gameMode;
  Localresult;

  constructor(navParams: NavParams, public modalController: ModalController) { 
    this.gameMode = navParams.get('gameMode'); 
    this.Localresult = navParams.get('Localresult'); 
  }

  ngOnInit() {
  }

  ionViewWillLeave(){
    this.closeModal();
  }

  async closeModal() {
    const onClosedData: string = "This is Data";
    await this.modalController.dismiss(onClosedData);
  }



}

The data that is returned to my service file is undefined. Is it because I am using the JavaScript setTimeout() function?

Android status bar no icon shown

$
0
0

Thanks for the tip! It was great

Compile stuck bug IonMenuToggle wrap withRouter

$
0
0

ohw thank you gonna try it out
Thanks

Environment setup in windows

$
0
0

i am getting the error while building the project for android. And i have done the environment setup already. Please help. Thank you

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\lenovo\AppData\Local\Android\Sdk (DEPRECATED)
Requirements check failed for JDK 8 (‘1.8.*’)! Detected version: 14
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.

Release app debuggable with Android Emulator

$
0
0

After building app with

ionic cordova build android --prod --release

Then jarsign and zipalign

I am able to debug the resulting APK in an emulator using Chrome Dev Tools just like is possible for a debug app.

I added the below to config.xml but it still does not help

    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
        <application android:debuggable="false" />
    </edit-config>
Viewing all 231638 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>