I have the same issue with the “plugin not found”, I’ve install the plugin via the CLI and it said “Plugin “phonegap-plugin-push” already installed on android.”, but when i run the app on device, it said “plugin not found”.
Hope you can foud the solution, and share it out with us. BTW, I use ionic1.
So I put the ionicPush in platform.ready, when I run my app in device, it still show me the “push plugin not found” error.
Here’s my code. Any idea?
$ionicPlatform.ready(function () {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
if ($window.geofence) {
$window.geofence.initialize();
}
$ionicPush.register().then(function (t) {
alert(t);
console.log(t);
}, function (error) {
alert(error);
});
});
in the ionic 2 you should manually instantiate push object.
Example from documentation:
var push = Push.init({
android: {
senderID: ‘12345679’
},
ios: {
alert: ‘true’,
badge: true,
sound: ‘false’
},
windows: {}
});
Hi,
From my understanding, the push plugin (from ionic-cloud) doesn’t work in the browser, that is expected.
The good news is that it should work nonetheless on a real device.
I was not satisfied with any of the answers here after I too ran into this problem, so here is how I solved it.
The problem occurs because I was attempting to view my app in the browser which doesn’t support push capabilities, since that can only work when running a device.
So I just needed to add an if statement that only runs the device-specific code when my code is running on an actual device.
In the constructor of the app.component.ts, we’re instantiating the Platform service and declaring it as the ‘platform’ variable. (see pic)
All we have to do is call one of Platform’s built-in methods to check on what platform we’re emulating our app on! This can be done easily by encasing our code in the following if statement ()
Hello @starkemc,
I don’t test for ios yet, my expectation is that you could simply check for “is not browser” rather “is android”.
Something like
if (!this.platform.is(‘browser’))
…