iOS push notifications not showing up through Parse local server - parse-platform

I'm doing whatever i can to send ios push notifications to a react-native app and for that app to display notifications.
I've been trying to figure this out for months.
I have a local Parse server running with the following config:
{
"appId": "org.reactjs.native.example.ReactZeroNotifications",
"masterKey": "masterkey",
"databaseURI": "mongodb://localhost/test",
"push": {
"ios": [
{
"pfx": "reactnotification-dev.p12",
"bundleId": "org.reactjs.native.example.ReactZeroNotifications",
"passphrase": "*",
"production": false
},
{
"pfx": "reactnotification-prod.p12",
"bundleId": "org.reactjs.native.example.ReactZeroNotifications",
"passphrase": "*",
"production": true
}
]
}
}
I then send a post request to http://localhost:1337/parse/push with the following headers:
X-Parse-Application-Id: org.reactjs.native.example.ReactZeroNotifications
X-Parse-Master-Key: masterkey
and the following raw JSON data:
{"where": {"deviceType": "ios"},"data":{"alert": "hello NOTIFICATIONS!!"}}
Meanwhile I have a react-native app running with pushnotification linked as a library and I receive the register event with a token.
However, my notification event never goes off and I never see a notification at the top of my iPhone as I'm trying to accomplish.
(Note: I just want to see a notification on a react-native app... no matter how this is accomplished, I feel as if I could figure out the rest if I can just get it to work once)
As per recommendation i turned on verbose on the parse server and received the following after posting:
verbose: sending push to 0 installations
verbose: sent push!
0 success, 0 failures

Related

Authentication problem with running ionic app using firebase on native device, everything works fine with live reload

Good morning!
I have a strange problem where i can run & authenticate my user on my ios device perfectly fine running the app using the command below.
ionic capacitor run -l --external
Using an emulator, it works sometimes, though not always.
When I try to deploy the app using Xcode, the app opens and looks normal, but if I try to send authentication requests to firebase, the app just keeps on loading, although the requests are successfully performed.
I first thought the problem was because of using LocalStorage so I rebuilt everything using Ionic Storage. But that didn't help.
I tried different versions of adding the Firebase SDK in Swift or in the Cocoa Pods file but the behaviour doesn't change so I don't believe that this is a issue with a wrong firebase configuration, what is the proper way to do this by the way - or is Ionic doing this for me already?
The output of Xcode doesn't provide any valuable information either.
2021-12-01 11:20:13.990875+0100 App[3162:27661] Writing analzed variants.
2021-12-01 11:20:14.125754+0100 App[3162:27661] KeyboardPlugin: resize mode - native
⚡️ Loading app at capacitor://localhost...
2021-12-01 11:20:14.552490+0100 App[3162:27661] Writing analzed variants.
⚡️ WebView loaded
⚡️ [log] - Angular is running in development mode. Call enableProdMode() to enable production mode.
⚡️ [log] - null
⚡️ To Native -> App addListener 60635511
2021-12-01 11:20:21.393141+0100 App[3162:27661] [Accessibility] WKContentView[#] set up: # pid: # MACH_PORT -830404096
login-function
loginWithEmail() {
let email: string = this.loginForm.get("email").value;
let password: string = this.loginForm.get("password").value;
this.loadingService.present({
message: "Logging in . . ."
});
this.authService
.loginWithEmail(email, password)
.then((result) => {
this.authService.SetUserData(result.user)
this.resetLoginForm();
this.loginSuccess();
this.router.navigateByUrl("/tabs/intensity");
})
.catch(error => {
console.log(error);
this.loginFailed(error);
});
}
login-success
loginSuccess() {
this.loadingService.dismiss();
this.toastService.present({
message: "Welcome back!",
duration: 3000,
color: "secondary"
});
}
login-with-email
import { AngularFireAuth } from "#angular/fire/compat/auth";
...
async loginWithEmail(email: string, password: string) {
return await this.afAuth.signInWithEmailAndPassword(email, password);
}
set user-data function
SetUserData(user) {
this.user = user;
const userRef: AngularFirestoreDocument<any> = this.afs.doc(`users/${user.uid}`);
const userData: User = {
uid: user.uid,
email: user.email,
displayName: user.displayName,
photoURL: user.photoURL,
emailVerified: user.emailVerified
}
return userRef.set(userData, {
merge: true
})
}
Running it multiple times some times I get this error.
API error: <_UIKBCompatInputView: 0x7fb965726040; frame = (0 0; 0 0); layer = <CALayer: 0x600002f718a0>> returned 0 width, assuming UIViewNoIntrinsicMetric
I am really stuck on this and would appreciate any help. Thank you & kind regards.
Ionic 6.18.1
Angular 12.1.5
Xcode Version 13.1 (13A1030d)

Problem with ask (alexa skill kit) CLI- ask deploy and ask dialog/simulate creating odd error. Maybe problem with connecting to the endpoint

Everything worked fine, until I started to get this error when I use "ask dialog":
Error: This utterance did not resolve to any intent in your skill. Please invoke your skill and try again with a different utterance or update your interaction model to include this utterance before testing again.
After a few tries, I tried to deploy my changes, and see if I can test properly in the console.
It didn't work, although it seems the deployment was successful. I tried to change my profile in "ask init", I tried to remove and reinstall ask-CLI, but this also didn't work.
I tried to clone a skill I had created in the console, and it worked, but when I tried to make changes and deploy, the error came back.
I tried to use "ask simulate" with --force-new-session, but it still didn't work.
I ran "ask dialog" and "ask simulate" with --debug,
This is the output-
{
"id": "fb2869d0-a324-42f6-bca9-4adc0af3476f",
"status": "FAILED",
"result": {
"alexaExecutionInfo": {
"consideredIntents": [
{
"name": "<IntentForDifferentSkill>"
}
]
},
"error": {
"message": "This utterance did not resolve to any intent in your skill. Please invoke your skill and try again with a different utterance or update your interaction model to include this utterance before testing again."
}
And when I inserted it to lambda test, the output was-
{
"errorType": "TypeError",
"errorMessage": "handlerInput.t is not a function",
"trace": [
"TypeError: handlerInput.t is not a function",
" at Object.handle (/var/task/index.js:133:42)",
" at GenericRequestDispatcher.<anonymous> (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:210:59)",
" at step (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:44:23)",
" at Object.next (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:25:53)",
" at fulfilled (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:16:58)"
]
}
The lines in the code-
const ErrorHandler = {
canHandle() {
return true;
},
handle(handlerInput, error) {
const speakOutput =handlerInput.t('ERROR_MSG');//line 133:error
console.log(`~~~~ Error handled: ${JSON.stringify(error)}`);
return handlerInput.responseBuilder
.speak(speakOutput)
.reprompt(speakOutput)
.getResponse();
}
};
I don't know why handlerInput.t suddenly doesn't work, however the problem is in errorIntentHandler, so besids this error, we have the original error.
I tried to debug using my own Node.js endpoint (which, unsurprisingly, didn't work), and it seems that there is a problem with the the endpoint connection.
When it worked before, I usually received a request JSON into my commend line, but now the connection fails before that.
Note:
I tried to open a lot of new projects, so I could check this out.
It didn't worked even after creating new project with ask init and immediately ask deploy.

aws-amplify subscription to appsync stops after 2 mins

When subscribing to appsync using amplify using API.graphql(graphqlOperation(subscription)); the subscription works for a while, but the I get socket closed error.
CONSOLE LOG [native code]: {
"[INFO] 24:12.893 MqttOverWSProvider": {
"errorCode": 8,
"errorMessage": "AMQJS0008I Socket closed.",
"uri": "wss://<uri>
The same subscription works in the appsync console without any issue and I get events as long as the subscription is running, but stops after around 2 mins on device.
code involved
let cs = await this.subscriptionService.appSubscriptions();
this.sbscriptions = this.cs.subscribe({
next: data => {
console.dir(data);
},
error: error => console.dir(JSON.stringify(error)),
close: () => console.log("closed")
});
This part of code throws no error, and the error shown above is only visible when setting LOG_LEVEL = DEBUG
NOTE : The subscription does work for a while before this error shows up, and in that time I can see all the events that I trigger from console.

Kony service giving 1012 opstatus Request failed error and not giving response

I have a kony sample app where I am trying to do a build and the app has one web service in it for fetching categories of some product. I have the following code also that I wrote:
function GetCategories() {
var inputparam = {
"appID": "bbuy",
"serviceID": "GetCategories",
"catId": "cat00000",
"channel": "rc",
"httpheaders": {}
};
kony.net.invokeServiceAsync("http://192.168.42.134/middleware/MWservlet",inputparam, serv_GetCategoriesCallback);
}
I am getting no response for this. Getting 1012 opstatus and the message is saying "Request failed" error.
kony.net.invokeServiceAsync("http://192.168.42.134/middleware/MWservlet",inputparam, serv_GetCategoriesCallback);
In the above line, you have not given the port number in the MWservlet URL.(e.g. 8080) Give that and check.
Also, make sure all input params are being fed to the service and that they correspond to the exact naming convention followed in the service editor.
Visit :
Find the below link. i hope it gives you a solution
http://developer.kony.com/twiki/pub/Portal/Docs/API_Reference/Content/Network_APIs.htm#net.invo2
Check the mandatory and optional fields of Inputparam

Using Parse push as stand alone service

I am building and iOS and Android app (two apps).
I am looking for a replacement for Urban Airship which I do not longer trust. Mainly
because I see no prices anywhere.
I want to use Parse Push as a stand alone product. Is this possible?
I do not want to use any of the other Parse functionality.
As explained in the Parse Push notification ( iOS like Android ) setup at https://parse.com/docs/push_guide#setup/iOS
Yes, you could. Of course you will need to include the parse sdk, since you'll need to register the devices through the Parse system. So:
Once you register the device for receiving push notification ( iOS example )
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
// Store the deviceToken in the current Installation and save it to Parse.
PFInstallation *deviceInstallation = [PFInstallation currentInstallation];
[deviceInstallation setDeviceTokenFromData:deviceToken];
// this will be used later for sending push notifcations to this device
[deviceInstallation setChannels:#[deviceToken]];
[deviceInstallation saveInBackground];
}
Sending Push notification through iOS
PFPush *pushObj = [[PFPush alloc] init];
NSString* destDeviceToken = #"<DESTIONATION DEVICE TOKEN>";
// Through channels, you can uniquely identify devices or group of them for multicast
// push notification (imagine that more than one installation on your
// Parse database keep the same channel name).
// In this case we have set the channel name for each installation with the
// only unique deviceToken
[pushObj setChannels:#[destDeviceToken]];
// Push structure message
[pushObj setData:#{#"My Message!!",#"alert"}];
// send push ( so, send to parse server that handle the push notification
// request and deliver it for you)
[pushObj sendPushInBackground];
Sending Push notification through Android
String destDeviceToken = "<DESTIONATION DEVICE TOKEN>";
JSONObject data = new JSONObject("{\"alert\": \"My Message!!\"}");
ParsePush *push = new ParsePush();
push.setChannel(destDeviceToken);
push.setData(data);
push.sendPushInBackground();
Sending Push notification through Javascript (Cloud Code)
(it requires implementation on the Cloud code of Parse)
var destDeviceToken = '<DESTIONATION DEVICE TOKEN>';
Parse.Push.send({
channels: [ destDeviceToken ],
data: {
alert: "My Message!!"
}
}, {
success: function() {
// Push was successful
},
error: function(error) {
// Handle error
}
});
Sending Push notification through REST call
(it allow you to perform a sending push notification without working on Parse anymore, so from any other platform that support a REST call)
curl -X POST \
-H "X-Parse-Application-Id: <YOUR PARSE APP ID>" \
-H "X-Parse-REST-API-Key: <YOUR REST API KEY>" \
-H "Content-Type: application/json" \
-d '{
"channels": [
"<DESTIONATION DEVICE TOKEN>"
],
"data": {
"alert": "My Message!!",
}
}' \
https://api.parse.com/1/push
In this way you don't need any additional implementation, like registering users or something like that.
Hope it helps!

Resources