Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70762

Application sharing

$
0
0

@raisadr wrote:

Hi! I’ve been trying to use Social Sharing, and this is my code:

import { Component } from '@angular/core';
import { SocialSharing } from '@ionic-native/social-sharing/ngx';

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {
  text = 'Check this out moron';
  url = 'https://ionicacademy.com';

  constructor(private socialSharing: SocialSharing) { }

  shareEmail() {
    this.socialSharing.canShareViaEmail().then(() => {
      // Sharing via email is possible
    }).catch((e) => {
      console.log(e);
      
      // Sharing via email is not possible
    });


    // Share via email
    this.socialSharing.shareViaEmail('Body', 'Subject', ['recipient@example.org']).then(() => {
      // Success!
    }).catch((e) => {
      console.log(e);
      
      // Error!
    });
  }

  shareWhatsApp(){
    this.socialSharing.shareViaWhatsApp(this.text, null, this.url).then(()=> {

    }).catch(e => {
      console.log(e);
      
    })
  }

}

In my code, I put the url is for the ionicacademy website, is it possible to replace the url as the current page of my app?

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 70762

Trending Articles



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