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

Ionic/react version 4

$
0
0

Hi,
im new to ionic
is it possible to add material ui in ionic react and use it in android or ios directly


Bluetooth Printer

$
0
0

I like how people are trying new and innovative things. You can achieve this thing very easily. Please mention are you using an inkjet printer or a laser printer. A laser printer will be very good for this option. You might face problems like brother wireless printer offline windows 10 error, but it’s easily solvable.

Ionic 4 camera preview is showing white background

$
0
0

I am using ionic camera preview. But I can only see a white background like shown in the foto. Does someone have an idea to solve this.

I already tried to do scss

ion-content,body, .app-root, ion-split-pane, ion-app,.scroll-content,.fixed-content,page-app {
–background: none transparent !important;
}

I am using ionic camera preview. But I can only see a white background like shown in the foto. Does someone have an idea to solve this.

I already tried to do scss

ion-content,body, .app-root, ion-split-pane, ion-app,.scroll-content,.fixed-content,page-app {
    --background: none transparent !important;
}

and tried to solve the issue with z-index, but did not succeed.

What I see is this:

These are my camera options:

  const cameraPreviewOpts: CameraPreviewOptions = {
    x: 0,
    y: 0,
    width: window.screen.width,
    height: window.screen.height,
    camera: 'rear',
    tapPhoto: true,
    previewDrag: false,
    toBack: true,
    alpha: 1
  }

Can anyone help?

How to get the LocalStorage value out of promise scope ionic 4

$
0
0

yes
it is really easy for start in you`re service create a function and then paste below text on that. for example i have a method to show PROFILE info in USER-STORAGE service

//read user to show in profile pages
//Iuser this my interface you can see on below
// this method return Promise
read_to_show_profile(): Promise {
return this.storage.get(user_storage_DB);
}

//
export interface Iuser {
id: string;
name: string;
mobileNumber: number;
city: string;
subCity: string;
galleryName: string;
imageSrc: string;
}
/
*/

and then in you`re component u can import SERVICE and use it like below
MY.COMPONENT.TS file

public current_usr: Iuser = {};

constructor(
private storage_service: StorageUserService
) {}

ngOnInit() {
//read data from local storage and assign it to CURRENT_USER
this.storage_service.read_to_show_profile().then(result => {
this.current_usr = result;
console.log(this.current_usr);
});

Ionic 4: change ion-content background-image programmatically (iOS)

$
0
0

Thank you for your reply, I’m just using them for showing images on iOS , this problem doesn’t exist on Android.
I think it’s a problem related to iOS caused by webview.
I tried so many solution for ion-content even the solution in issue that you gave me and it didn’t work.
For now I will just show the image with < img >.

__zone_symbol__state: null, __zone_symbol__value: Array(0)

$
0
0

I Solved this

yes
it is really easy for start in you`re service create a function and then paste below text on that. for example i have a method to show PROFILE info in USER-STORAGE service

//read user to show in profile pages
//Iuser this my interface you can see on below
// this method return Promise
read_to_show_profile(): Promise {
return this.storage.get(user_storage_DB);
}

/ /
export interface Iuser {
id: string;
name: string;
mobileNumber: number;
city: string;
subCity: string;
galleryName: string;
imageSrc: string;
}
/
*/

and then in you`re component u can import SERVICE and use it like below
MY.COMPONENT.TS file

public current_usr: Iuser = {};

constructor(
private storage_service: StorageUserService
) {}

ngOnInit() {
//read data from local storage and assign it to CURRENT_USER
this.storage_service.read_to_show_profile().then(result => {
this.current_usr = result;
console.log(this.current_usr);
});

Customized Headers

Ion-searchbar: pass filtered list results to another page

$
0
0

Hi,
You can create a subject behaviour in your service :

bar: BehaviorSubject<yourType> = new BehaviorSubject<yourType>(undefined);

undefined is default value you can change it.

when you need to pass data call .next(data)

this.service.bar.next(data);

then subscribe to get data:

this.service.bar.subscribe((data) => {});

Weird Text FullScreen Issue with Ionic 4 and iOS App

$
0
0

Hello,
I’m using Capacitor to build the iOS App.

I have a weird issue,
When the app start (after SplashScreen) this what I have currently.

I have no idea why i’m getting this and I have no errors on the Xcode area debug and also in Safari Inspector tools.

So my question is : Do you have any ideas what’s wrong ? I have follow the documentation.

Thank you for your kind attention!

How to create TCP Socket server connection using Angular in Ionic 4?

$
0
0

Hi,
I would like to create TCP Socket server connection in iOS and I’m using Angular in Ionic 4.
Is there any API available for it?

Close an alert with keyboard AND retrieve its input value

$
0
0

Thanks for your help :slight_smile: . Here is the solution i ended up with :

In the present_Alert function :

//Focus the input when the alert popup so the user can write his command directly
        await alert.present().then(() => {
            const firstInput: any = document.querySelector('ion-alert input');
            firstInput.focus();
            return;
        });

        this.alert_window = alert;

Outside of the function :

//Listen to the "enter" keyboard press event when the alert window (for exec or tmux) is open
    @HostListener('document:keydown.enter', ['$event'])
    onKeydownHandler(event: KeyboardEvent) {
        if (this.alert_window) {
            const okButton: any = document.querySelectorAll('ion-alert button')[1];
            okButton.click();
            this.alert_window.dismiss();
            this.alert_window = null;
        }
    }

Basic-Auth against Proxy, then open Website behind that Proxy

$
0
0

Hi all,

we want to perform a basic authentification against a proxy server. This is already working. When the authentification was successfully i want to open a webpage within an iframe or in the inApp Browser plugin from Capacitor. The webpage shows “unauthorized” - i think the context or something else is not the same?

proxyAuthentification(user, password): Promise<any> {
        const url = 'https://connect.deos-ag.com';
        const headers = new Headers();
        headers.append('Authorization', 'Basic' + btoa('USER' + ':' + 'PASSWORD'));

        const base64Auth = this.nativeHttp.getBasicAuthHeader(user, password);

        return new Promise((resolve, reject) => {
            this.nativeHttp.get(url, {}, base64Auth)
                .then(data => {
                    console.log('data:', data);
//                    NOW OPEN A SPECIFIED WEBSITE BEHIND THAT URL
                    resolve(data);
                }, (err) => {
                    console.log('error status', err.status);
                    console.log('error message', err.message);
                    console.log('error headers', err.headers);
                    reject(err);
                });
        });
    }

How could we achieve the desired behaviour?

Ionic 3: Clicking a DeepLink

$
0
0

Its been a good while sense I got looking through deeplinking.

Something I’m missing about calling/clicking a deep link in an Ionic App. Hoping I’m going down the right path here.

A deep link is just a URL. I have one set up through Branch.io. I want to be able to click this link in an Ionic app. This is what I’m doing now.
var link = document.createElement(“a”);
link.href =“https://cool-app.app.link/niceapp”;
link.id = ‘app-link’;
link.click();
document.getElementById(‘app-link’).remove();

On a Samsung S7 (android 8) click the link. The script code above is called.
So a browser opens then takes the user to app store. So far so good. A chrome screen is open in the users app history with a blank chrome tab. Also sometimes this won’t work, it just a blank chrome screen. (The URL is correct in the browser).
Is there a better way?

Once I have the linked app installed. Then try the deep link again, I am prompted to open the app or open it in chrome.
Any way to not have it to do this either?

Cordova camera plugin not launching camera

$
0
0

Im facing the same issue here. Any updates?

Project structure for the new Ionic Studio

$
0
0

How do I access the app.module and route.module ?
All I have access no is pages and app components.


Ionic Tabs and tildes

BackgroundMode by default?

$
0
0

I am using an audio HTML5 in the background of my app, but when I minimize the app, the sound continues to play. I’ve seen people asking how to make it continue to play on standby mode, which I assume was not the default behavior.

However, in my case, it looks like that by default, it plays without adding any line of code.

How can my sound not play when the app is minimized?
There must be some setting in ionic to keep playing… :frowning: how do I turn this off?

HTTP requests not working even though using android:usesCleartextTraffic="true"

$
0
0

Hi,
I’m trying to migrate my project to Ionic with Capacitor. The problem is, I’m using HTTP requests during development and while this worked with Cordova, I’m not able to make successful requests to my .NET Core 3.1 Web API.

This is my ionic info output:

Ionic:

Ionic CLI : 6.0.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 4.11.10
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.1.2

Capacitor:

Capacitor CLI : 1.5.0
@capacitor/core : 1.5.0

Utility:

cordova-res : 0.9.0
native-run : 0.3.0

System:

NodeJS : v10.16.3 (/usr/local/bin/node)
npm : 6.13.7
OS : macOS Catalina

I added android:usesCleartextTraffic=“true” to AndroidManifest.xml so I’m guessing that should work. Just as all answers I find here, Google and StackOverflow.

This wasted hours and hours already and I just can’t get it working.

The .NET Core App runs on http://localhost:5000 and when I try to call it, I only get

zone-evergreen.js:2952 OPTIONS https://localhost:5001/api/v1/users net::ERR_CONNECTION_REFUSED

Has anyone been able to get this working? If you need any other info/output please let me know :neutral_face:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

$
0
0

I’m confused by your question, because the end of your post doesn’t seem to be consistent with the error in the thread title. The thread title is caused by your server process not returning JSON. I don’t do PHP, so somebody else is going to have to deal with why that is happening, but some other notes:

  • Never use MD5 for anything. It’s basically ROT13 at this point. For password hashing, use an algorithm designed for it, such as bcrypt.
  • You almost never need to be declaring Content-Type in an Angular app, and certainly not here. Let Angular do it.
  • Ditto with manually stringifying the body - not needed and actually harmful here
  • Get rid of map(res => res) - it’s pointless
  • Always put proper types on all parameters and function return values - it will make your code much easier to read and debug
  • Conversely, you don’t need to type properties like server that are initialized inline to a knowable type

Installed ionic but giving error ionic command not found

$
0
0

As the message is telling you, the package has been renamed from ionic to @ionic/cli. Also, you would likely benefit from using nvm to manage your node installation.

Viewing all 228529 articles
Browse latest View live


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