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.
Related
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!
I create Xamarin.Forms app and use Acr.Biometrics plugin. In PCL I check available finger print for device.
private async void AvailableBiometric()
{
bool available = await Biometrics.Instance.IsAvailable();
lblStatus.Text = available ? "Yes" : "No";
}
When I launch my app on Windows 10 emulator (UWP project), I get result false ("NO") and it's correct. But when I launch app on Android 6.0 (Emulator or real device with finger authorization), I get Exception "".
I find source code this plugis on GitHub. My Exception generate this plugin's code:
I don't understand what do I wrong and why for Windows app this Exception did not generate. If who know, please, help me.
I don't understand what do I wrong and why for Windows app this Exception did not generate.
I tried to only install Acr.Biometrics Package to PCL, and debugged UWP project. It also threw the exception.
If you want to use lib of Acr.Biometrics in Android and UWP platform,
please make sure you have installed Acr.Biometrics nuget package to Android and UWP project.
You can right click your solution--> Manage NuGet Package for solution-->select the Installedbutton-->left click Acr.Biometrics NuGet Package.
Check the xxx.Droid project option.And then press the install button. The installation is done later.
For Android support, you need to add the following to your AndroidManifest.xml:
<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
Usage
In your shared/PCL library, simply check if the sensor is available:
protected async override void OnAppearing()
{
base.OnAppearing();
if (await Biometrics.Instance.IsAvailable())
{
var success = await Biometrics.Instance.Evaluate("Your custom message");
if (success)
{
//do some stuff
}
}
}
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 am trying to use this sms plugin - https://github.com/Ivanezko/Phonegap-SMS in my ionic android application. I am following the Readme documentation to install the plugin. In the second step author asked to do -
Require the plugin module
var smsplugin = cordova.require("info.asankan.phonegap.smsplugin.smsplugin");
What this statement means and where should I include this code to make use of this plugin?
I tried to do this in my controller file and its giving error cordova is not defined.
I tried debugging a little more in an emulator and the error given in the require statement is - module info.asankan.phonegap.smsplugin.smsplugin is not found.
First solution: 1. check that this plugin is wrapped by http://ngcordova.com/.
Second solution: 2. write wrapper = angular factory:
.factory('factoryname', ['$q', '$window','$state', function ($q,$window, $state) {
return {
function1: function () {
var q = $q.defer();
if (!$window.cordova) {
q.reject('Not supported without cordova.js');
} else {
secrettext.function1();
return q.promise;
},
3th solutions: add ['$window'] dependency to module you want use plugin. and use secrettext.function1();
*sectretext its clobbers from plugin xml
4 th solutions copy and paste this js code into you angular code on top of it and use function1();
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);
});
}