I have tried following documentation here http://ionicframework.com/docs/v2/native/device/ but am not getting anything back.
home.ts
import {Component} from '#angular/core';
import {Device} from 'ionic-native';
#Component({
templateUrl: 'build/pages/home/home.html',
})
export class HomePage {
public device;
constructor() {
this.device = {};
platform.ready().then(() => {
this.device['uuid'] = Device.device.uuid;
});
}
}
home.html
<li>Device UUID is {{device.uuid}}</li>
I have already ran ionic plugin add cordova-plugin-device
UPDATE: i am testing the app using IonicView App.
Debugging in the Chrome Debugger under different device sizes will not allow you to debug any type of code related to native device properties, hence you need to test your app through an emulator (ios/ android). Please note ionic serve allows you to view the app through the default browser application which isn't an emulator.
For reference on how to test your app through ionic on an emulator see the CLI Docs
Related
I have a React Native app with a custom native plugin.
The app works fine when I test it with Xcode on my device.
I uploaded the exact same app to the App Store and it got broken.
On my iPhone it doesn't actually start and on my iPad it is buggy:
I have to tap buttons twice
Code order is wrong (may threading / rendering)
Events from the plugin sometimes get fired and sometimes not. Totally random. (could also be rendering issue)
Unfortunately, I can't debug the TestFlight App.
Does someone have a starting point why this could happen?
I found the problem. It was in my Plugin and how I expose it. My index.ts file looked like this:
import { NativeModules } from 'react-native';
const { MyPlugin } = NativeModules;
export default MyPlugin;
Better with no default export:
import { NativeModules } from 'react-native';
export const { MyPlugin } = NativeModules;
I don't know why a default export doesn't work in release mode. I tried all release flags to be the same as default, but it was the same result.
So, just changing the way of export was fixing it.
I m using native storage in ionic 3 but when I close the app it clear data automatically but works fine in android
import { NativeStorage } from '#ionic-native/native-storage';
constructor(private storage: NativeStorage, private http: HttpProvider) {
this.storage.setItem('List', List);
I got the same issue I changed to #ionic/storage and I fix it.
I am developing an app in ionic 3 for android and ios platform. For deeplinking, I am using cordova firebase dynamic link plugin.
This is working fine for android platform. But in the ios platform, though it is not throwing any error, it is not working.
My current ionic code.
this.platform.ready()
.then(() => {
return this.firebaseDynamicLinks.onDynamicLink();
}).then((dynamicLink:any) => {
console.log(dynamicLink); // always gives {matchType: "weak", deepLink:""} in ios
}).catch((error: any) => {
console.log(error);
});
The android part working fine. But in ios, the deeplink is always coming as empty.
my manually created dynamic url
https://xxxx.app.goo.gl/?link=<encoded url to mysite>&apn=<android bundle id>&ibi=<ios bundle id>
The provided link is returning HTTP 200 status when opening in the browser.
Testing steps (in ios):
In my iphone (ios9) I have placed this dynamic link in notepad
Then by clicking on the dynamic link the app opens.
In the console, I get
{matchType: "weak", deepLink:""}
I just installed React Native, and am attempting to follow tutorials on the React Native website to get accustomed to it. However every tutorial I end up doing just gives me a big red error screen in the iOS Simulator.
As an example, I followed the "Hello World" tutorial on the React Native website
import React, { Component } from 'react';
import { AppRegistry, Text } from 'react-native';
class HelloWorldApp extends Component {
render() {
return (
<Text>Hello world!</Text>
);
}
}
AppRegistry.registerComponent('HelloWorldApp', () => HelloWorldApp);
but am met with this error after compiling and running in the simulator"
"Application TestProject has not been registered. This is either due to a require() error during initialization or failure to call AppRegistry.registerComponent"
I'm confused because I know nothing yet about RN, am following their tutorials to the letter, and am getting errors.
Please advise?
There might be two possibilities as I know of:
When you run react-native run-ios the packager didn't start automatically. If that's the case, Run the Packager Manually. To do so:
In one Tab of your terminal run react-native start and in another run react-native run-ios.
Or while following the document from react native's site, you might have changed the app's name. Like:
You created a project using react-native init AwesomeProject. The Project's name here is AwesomeProject.
And then changed your default index.ios.js and replaced the Component's name with HelloWorldApp.
class HelloWorldApp extends Component
AppRegistry.registerComponent('HelloWorldApp', () => HelloWorldApp);
I'm using PhoneGap + jQuery Mobile for a new mobile app.
This plugin is used to call native contact view of Android so you don't have to inject contacts in HTML.
https://github.com/phonegap/phonegap-plugins/tree/master/Android/ContactView
I've followed the instructions properly but it doesn't work for me, whenever I try to run (after all the initialization routine) this JS on Android:
window.plugins.contactView.show(
function(contact) {
console.log(contact);
},
function(fail) {
console.log(fail);
}
);
It shows this error:
Error: Status=2 Message=Class not found
Can anyone help?
Note: I haven't used any PhoneGap plugin before.
http://simonmacdonald.blogspot.com/2011/05/installing-childbrowser-plugin-on.html
The issue has been described here in details.