i'm trying to implement Code-Push from AppCenter into my Ionic v4 App. (ref)
I'm stuck on the following Problem: I can update the App, but when i close the App after that and open again it is the old Version again and it says:
Updade ignored, because it was rollbacked
So somehow the update is rolled back after i close the App. After searching for this problem i found that i have to run
this.codePush.notifyApplicationReady()
on application start. I added this to my code, but it doesn't work either. If i run the Application on a Android Emulator and open the Logs, AFTER the Update it says:
cordova_not_available
So it makes sense that the notifyApplicationReady doesn't work, but why is cordova unavailable?
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.codePush.notifyApplicationReady().then(value => {
console.log(value);
});
this.codePush.sync({
deploymentKey: 'MY_KEY',
installMode: InstallMode.IMMEDIATE
}).subscribe(status => {
console.log(status);
});
this.splashScreen.hide();
});
}
Do u use command ionic build --prod ? this conmand will not include cordova.js,so if app installed this package the cordova will not available, in ionic4 i use ionic cordova build android --prod to include the cordova.js and then release the www file to code push serve.it wokrs!
Related
Issue Description
I installed the library via npx react-native link react-native-navigation (and modifying the minSdkVersion in andoid/build.gradle).
When I run npx react-native run-android, the app is built and works fine, though I get the following error in the terminal:
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
- react-native-navigation (to unlink run: "react-native unlink react-native-navigation")
Since the lib has been linked manually, I add an entry in the react-native.config.js file to prevent react native to try to autolink the lib, as in:
module.exports = {
dependencies: {
'react-native-navigation': {
platforms: {
android: null, // disable Android platform, other platforms will still autolink if provided
},
}
}
};
Now, the CLI error is not longer shown and the app is successfully built, but I get an error in the emulator:
TypeError: null is not an object (evaluating "this.nativeCommandsModule.setRoot()").
Which comes about at my first Navigation.setRoot(...); call:
[index.js]
const start = () => {
Navigation.events().registerAppLaunchedListener(() => {
registerScreens();
gotoInitialising();
// gotoLogin();
});
};
start();
My question is, what extra step should I take to get the lib to work and to not have a React Native CLI error, at the same time.
Environment
React Native Navigation version: 6.0.1
React Native version: 0.61.5
Platform(s) (iOS, Android, or both?): Android
Device info (Simulator/Device? OS version? Debug/Release?): Android emulator API 28 - (emulator version 29.2.1-5889189) - Debug build
FYI, since react-native-navigation#6.1.0, the link script has been fixed to update the minSDK for android as well.
Also you should not add react-native-navigation in react-native.config.js as the RNN library is required to be used in your native code. The team has updated the documentation to make the installation guide clearer: https://wix.github.io/react-native-navigation/docs/installing. If you follow the guide, it should be quite straightforward.
run the following command: react-native unlink react-native-navigation
My app is under Ionic 4 for android and I have to open/run/launch external app (for exemple com.google.android.youtube or com.sygic.truck) -> for instance, any installed app.
I tested many options without any success :
InAppBrowserModule (using application://my.package.name).
Cordova plugin lampaa (I didn't find any ways to use it under angular/ts app type).
I tried also webIntent using package option and action option calling the main Activity.
For InAppBrowserModule, i'm stuck with the http:// protocole appended before my app url.
For Lampaa, i'm stuck with the undefined startApp (even after following other threads suggestions).
And for webIntent, I don't think that it's relevent for my issue.
Any suggestions ?
Thanks in advance !
[EDIT]
I finally make it works !
You can use one of those 2 lines :
this.iab.create('android-app://com.google.android.youtube',"_system");
window.open('android-app://com.google.android.youtube',"_system");
You can replace com.google.android.youtube by any application package name !
You can check if the user is on Android, have the app installed and later open it as follow:
constructor(
private platform: Platform, // from 'ionic-angular'
private appAvailability: AppAvailability, // from '#ionic-native/app-availability'
private iab: InAppBrowser, // from '#ionic-native/in-app-browser'
) {}
openYoutube() {
const package = "com.google.android.youtube"
if(this.platform.is('android')) {
this.appAvailability.check(package)
.then(()=> {
this.iab.create('android-app://'+package, '_system', 'location=yes')
})
.catch(()=> {
// not installed
)
} else {
// not on Android
}
}
For ionic 4 we can use
ionic cordova plugin add cordova-plugin-app-launcher
npm install #ionic-native/app-launcher
You can use the following cordova plugin to check if other apps are installed and launch them.
ionic cordova plugin add cordova-plugin-app-launcher
npm install #ionic-native/app-launcher
Simple Cordova plugin to see if other apps are installed and launch them.
I have created a simple app in Ionic that uses Native Audio to play a single MP3-file. The code:
export class MyApp{
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private nativeAudio:NativeAudio) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
this.nativeAudio.preloadComplex('24', 'assets/klamydihahaha.mp3',1,1,0.1).then(
(data)=>{
alert(data);
this.nativeAudio.play('24',()=>{alert("done")});
},(error)=>{
alert(error);
}
)
});
}
}
I run this on my Sony Xperia-device with Android 6.0 using
ionic cordova run android --device
The alert-message will first show "ok", it will wait and then the message "done" will show. But there is no sound. The MP3 file works fine. What can be the problem?
May be the cordova API is not included with your command
Instead type this command
ionic cordova run android --emulator
or
ionic cordova emulate android
I am trying to enable my phone bluetooth via ionic app. I am calling something like this:
cordova.plugins.locationManager.enableBluetooth()
But not enabling and making any error also. Following is my app.js code. Please help out.
import {App, Platform} from 'ionic-framework/ionic';
import {TabsPage} from './pages/tabs/tabs';
#App({
template: '<ion-nav [root]="rootPage"></ion-nav>',
config: {} // http://ionicframework.com/docs/v2/api/config/Config/
})
export class MyApp {
static get parameters() {
return [[Platform]];
}
constructor(platform) {
this.rootPage = TabsPage;
platform.ready().then(() => {
StatusBar.backgroundColorByName('red');
console.log("App starting.");
cordova.plugins.locationManager.enableBluetooth();
});
}
}
Is there anything I am missing. My phone is One Plus One.
UPDATE:
Is there any particular configuration I have to in device to achieve
this in develop mode
App technical info
Ionic 2 & Angular 2
Plugin : com.unarin.cordova.beacon (Link)
I resolved this myself. Seems to be issue was with petermetz/cordova-plugin-ibeacon, I was using 25days older plugin.
First removed the existing plugin by running by going into project root folder:
sudo cordova plugin rm com.unarin.cordova.beacon
Then again added the plugin (basically I updated my plugin):
sudo cordova plugin add https://github.com/petermetz/cordova-plugin-ibeacon.git
After that everything started working fine.
Thanks.
I'm having an issue with some android devices when changing the font-size display setting through configuration.
In web browser my app is simple ignoring this. This is true for some other mobiles too.
But with some specific mobiles (like Motorola G or X) changing this config also affects my Phonegap app.
I don't know how to avoid this to make the app look consistent
I've found a solution using this cordova plugin: com.phonegap.plugin.mobile-accessibility
You have to follow installation instructions for the plugin, and then you can use it inside Ionic app. You only have to ensure to call its functions after Cordova 'deviceready' callback (accesed by $ionicPlatform.ready in the example below):
angular.module('app').controller('IndexController', function ($ionicPlatform, $window) {
$ionicPlatform.ready(function(){
if($window.MobileAccessibility){
$window.MobileAccessibility.usePreferredTextZoom(false);
}
});
});
For anyone using Ionic. Documentation is here.
Install
$ ionic cordova plugin add phonegap-plugin-mobile-accessibility
$ npm install --save #ionic-native/mobile-accessibility
Add to module, i.e. app.module.ts
import { MobileAccessibility } from 'ionic-native';
#NgModule({
providers:[MobileAccessibility]
});
In app.component.ts
constructor( mobileAccessibility: MobileAccessibility, platform: Platform) {
platform
.ready()
.then(()=>{
mobileAccessibility.usePreferredTextZoom(false);
});
}