Safira Safira - 1 year ago 118
Android Question

Ionic shareAnywhere button not working

So I am new at android programming, and currently trying to make a function to share my android app using Ionic Framework.
This is the view:

<ion-item menu-close class="item item-icon-left" ng-click="shareApp('Aplikasi BeDA: ', '{{namaapk}}', '', '{{apk}}')">
<i class="icon ion-android-share-alt {{appcolor}}"></i>
<small>SHARE APLIKASI<small>

This is `(function() {
'use strict';

.controller('MenuController', function($scope, $stateParams, $ionicHistory, $http, $cordovaAppRate, $cordovaSocialSharing, $ionicPopup, Config, Color) {
var xhr = $http({method: 'get', url:'json/menu.json'});
$scope.namaapk = Config.NamaAplikasi;
$scope.apk = Config.GooglePlay;
$scope.appcolor= Color.AppColor;
$scope.shareApp = function(message, subject, file, link) {
.share(message, subject, file, link+$scope.apk)
.then(function(result) {
// Success!
}, function(err) {
alert("Error. We're sorry.");
$scope.goBack = function() {


But it's not working, on Chrome console it said:

TypeError: Cannot read property 'socialsharing' of undefined

I thought it's just a bug from Cordova. But when I install the app on my phone, the function didn't do anything.
What have I missed?

Answer Source

Have you added it to the project? The command line is :

ionic plugin add cordova-plugin-SocialSharing