Closed shivapersad closed 7 years ago
Hey @shivapersad , I do not see a screenshot. But yes, you need to create a mobile app and configure it for push notifications by adding your iOS cert and android api key. Without those you cannot use the plugin.
I created the mobile app and connected the Push service for the mobile app in Azure.
I am having different issues for iOS and Android. In iOS I am able to launch the application but when I send a push notification nothing is received on my iOS device. I am currently using the iOS Simulator on my Macbook to perform testing.
With respect to Android I have attached a logcat when the application launches. For Android I am presently using a physical Android device.
Thanks for any help you can give.
You cannot test push notifications on iOS Sim. You must use a physical device.
For Android - seems where you initialize the azure client the context is not present. So i'm assuming you are initializing somewhere before application start. You must init the client once the app has been initialized and started.
@PeterStaev I got through with Android!!! Able to push notifications from Azure to my physical Android device. Presently, working on the iOS side. Thanks for your help thus far. I'll let you know if I get any issues with iOS.
@PeterStaev I was able to get iOS to work as well. Notifications are a bit confusing but got the hang of it for my development devices. Thanks for your help!!
hi @PeterStaev , i have a nativescipt app that works with firebase, i try to add azure registration but after command tns plugin add nativescript-azure-mobile-apps On import import { MobileServiceClient } from "nativescript-azure-mobile-apps/client"; I've error message that tell me that module 'nativescript-azure-mobile-apps/client' non found
Plugin version 2.0.1 "nativescript-azure-mobile-apps": "~2.0.1",
Can you help me?
@Cambia86 , there is a demo app in this repo so you can look at it for how to use the plugin. Also please do not post in 1 year old closed issues. Instead submit a new issue describing your problem.
Hi,
I am trying to get Push Notifications set up in my application using Azure's Notification Hub. I have the code below implemented in my homepage.component.ts. Please note I have removed my senderID and Azure portal name. Also do I need to setup a Mobile App in Azure to obtain the Azure portal name? I am assuming that when the application loads and it attempts to create the MobileServiceClient it receives a null and crashes the application.
When the application loads I am presented with the screenshot attached. Any assistance you can give would be appreciated.
import { MobileServiceClient } from "nativescript-azure-mobile-apps/client";
let pushPlugin = require("nativescript-push-notifications"); let client: MobileServiceClient; var pushSettings = { // Android settings senderID: 'project number here', // Android: Required setting with the sender/project number notificationCallbackAndroid: function(message, pushNotificationObject) { // Android: Callback to invoke when a new push is received. alert(JSON.stringify(message)); },
client = new MobileServiceClient("https://.azurewebsites.net ");
pushPlugin.register(pushSettings, (data) => { if (pushPlugin.onMessageReceived) { pushPlugin.onMessageReceived(pushSettings.notificationCallbackAndroid); } client.push.register(data) .then(() => console.log("Azure Register OK!")) .catch((e) => console.log(e)); }, (e) => { console.log(e); });