Friends,
I need to add a “Share App” option for my app without showing a separate page . I mean it’s not open a separate page . My preferred ‘share app’ preview is
But my current implementation goto a page with name share …
share.ts
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { SocialSharing } from '@ionic-native/social-sharing';
/**
* Generated class for the SharePage page.
*
* See http://ionicframework.com/docs/components/#navigation for more info
* on Ionic pages and navigation.
*/
@IonicPage()
@Component({
selector: 'page-share',
templateUrl: 'share2.html',
})
export class SharePage {
constructor(public navCtrl: NavController, private sharingVar: SocialSharing,public navParams: NavParams) {
this.ShareOther();
}
ionViewDidLoad() {
console.log('ionViewDidLoad SharePage');
this.ShareOther();
}
whatsappShare()
{
this.sharingVar.shareViaWhatsApp("Download XXX Android app to avail various Yummy services. Click on below link to download", "https://lh3.pht.com/yd4faSRzLb-GTrmXGHSTDug97YeMRIdLfmwkLLsZXZWUTJLoikoKWhDp_W1Wt-kHPg=s180", "https://play.google.com/store/apps/details?id=in.gov.lsga.gov" /* url */)
.then(()=>{
alert("Success");
},
()=>{
alert("failed")
})
}
ShareOther()
{
this.sharingVar.share("Download Yummy Android app to avail various Govt services. Click on below link to download","Yummy Store","https://lh3.ht.com/yd4faSRzLb-GTrmXGHSTDug97YeMRIdLfmwkLLsZXZWUTJLoikoKWhDp_W1Wt-kHPg=s180","https://play.google.com/store/apps/details?id=in.ov.erala.ov" /* url */)
.then(()=>{
//alert("Success");
},
()=>{
// alert("failed")
})
}
ShareVia()
{
this.sharingVar.canShareVia("Yummy app", "Download Yummy app to avail various PVT services. Click on below link to download","https://lh3.ggpht.com/yd4faSRzLb-GTrmXGHSTDug97RIdLfmwkLLsZXZWUTJLoikoKWhDp_W1Wt-kHPg=s180" /*Image*/, "https://play.google.com/store/apps/details?id=in.ov.rala.mov" /* url */)
.then(()=>{
alert("Success");
},
()=>{
alert("failed")
})
}
}
My template is
<ion-header>
<ion-navbar color="primary">
<button ion-button menuToggle>
<ion-icon> <img class="title-image" src="assets/img/samagra.png" /> </ion-icon>
</button>
<ion-title>
mGov Services
</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
</ion-content>
above is a blank template. But I don’t need to show that. Just get a dialogue with share option in first model …
How to avoid to load this template , while functionality must work fine…
Please help
Thanks
Anes