(Before you mark this question as duplicate, please read the whole question)
I am using react-native-push-notification library in my React-Native Application.
In my app I have not initialized Firebase because I do not need any remote notifications as of now. Currently I am scheduling a local notification and when the notification comes I am expecting user actions from it. Based on the button pressed I want to make appropriate API calls.
So to achieve this I used PushNotification.configure method, but it is throwing me "Default FirebaseApp is not initialized in this process. Make sure Firebase is initialised" error.
I am being forced to use Firebase, when I have absolutely no need of it.
Could someone please help me out here, I have been searching for answer from past 2 days. I am quite new to React Native and I am still learning it. Any help is appreciated.
Thanks
Finally I found the solution, it was actually in the documentation itself but I somehow over looked.
I will post it here because I am sure there's someone like me out there.
We are supposed to add requestPermissions: Platform.OS === 'ios', in PushNotification.configure like this:
PushNotification.configure({
onNotification: function (notification) {
console.log('LOCAL NOTIFICATION ==>', notification);
},
// This line solves the problem that I was facing.
requestPermissions: Platform.OS === 'ios',
});
Related
I am trying to pass a parameter to another application.
I am using cordova-plugin-app-launcher to launch the other application.
Both applications are wrapped by Cordova and only are available on Android.
In this moment I don't have access to the code of the second application which is launched, so I can't test a solution right now.
I saw the GitHub documentation talks about extras, and for the launch part would be something like this:
window.plugins.launcher.launch({uri:'fb://profile', extras: [{"name":"param1", "value":"VALUE1", "dataType":"String"}]}, successCallback, errorCallback);
I would like to know how to retrieve this extra on the launched app (maybe on the App.controller.js?).
EDIT
I think this can be handled by this other plugin
document.addEventListener('deviceReady', function(){
window.plugins.intent.getCordovaIntent(function (Intent) {
console.log(Intent);
}, function () {
console.log('Error');
});
}
Can someone please confirm is this is the way to do this or this is a good/bad practice? I would like to know if you have any suggestion to perform this logic I would really appreciate it. Thanks.
Cordova apps cannot capture startup parameters out of the box.
Someone has tried and has a fix for iOS I believe but I haven't seen anything for Android.
See this issue
You might also want to look into https://www.npmjs.com/package/cordova-plugin-intent
I tested with SDK 5.1.1 on my Android 5.0.2 - HTC One M7.
The issue:
With ti.cloudpush, if I receive a notification but leave it there without clicking it. Instead I launch my app from launcher. Then the callback function is called but the notification isn't cleared. If later I click the notification, it will launch the app but no callback is called.
Can anyone confirm this behavior? I filed a jira ticket here, but Appc Team kept saying they couldn't re-produce.
Sample code and my configuration are in the jira ticket above. Please test and let me know if it's just me or a bug. Thanks!
As a workaround, you might be able to clear the notifications by calling http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Android.NotificationManager-method-cancelAll from the callback.
I'm using parse.com to send push notifications to android devices and it worked once and it registered the device's deviceToken correctly but suddenly it started adding |ID|1|: at the beggining and the notifications don't get to the devices that have that and they do to the ones that were already there.
I don't remember changing anything and I don't have any idea where that came from.
According to the documentation You should call ParseInstallation.getCurrentInstallation().saveInBackground() as soon as possible (after Parse.initialize()).
Are You sure this is the solution? It seems for me that is not connected in any way.
Turns out I was calling ParseInstallation.getCurrentInstallation().saveInBackground() before ParsePush.subscribeInBackground(...) in my Application subclass.
So I changed the order to
Parse.initialize(this, appId, clientKey);
ParsePush.subscribeInBackground(...);
ParseInstallation.getCurrentInstallation().saveInBackground();
and it started saving all the deviceTokens correctly.
I want to add a mark as read option to the pull down notification bar of Gmail but I don't have the slightest clue about where to start. If somebody can tell me how to do it or point me in the direction of the right docs to pull it off it would be much appreciated.
I know it is possible because it has already been done, but I want to do it by myself.
That's quite an undertaking.
So the link you provided has a bit of a walkthrough in its description about where to start. The trick is that because you're trying to program a notification service for an EXISTING app, you don't really have control over the notifications the app itself creates. I suspect what you're going to have to do is program a NotificationListenerService, listen for gmail notifications, and somehow cancel the gmail notification and replace it with one of your own, as created through the android documentation.
For a good example of how NotificationListenerService works please take a look at this:
https://github.com/kpbird/NotificationListenerService-Example
The canceling is something I have not tested but you asked for ideas, not code. NotificationListenerService has a method cancelNotification(String pkg, String tag, int id) which looks like you can use to cancel the gmail notification.
You can get access to the raw Notification-object using an AccessibilityService. I haven't tried it before to be honest, but I assume you can modify the Notification and add your own buttons, etc.
More information on tinkering with the Notification-object in an AccessibilityService here: https://stackoverflow.com/a/10303676/198996
I made a thread similar to this, but I want to elaborate.
Essentially I want to make an app that can be started up, run in the background and will receive messages from a server (the server is a linux server up that currently sends out messages with updates on a system I have to know about) and then give a notice to the person about the message and just kinda stay passively in the back unless it's closed down entirely. I am very new to Android and I have a similar function up on the web, but a web app is required. Any suggestions on what I should read first or anyone know a good tutorial of something similar?
Thanks
Start there : http://developer.android.com/guide/topics/fundamentals/services.html
start reading about services , (services are working in background ) ; and after , read about notifications in android :
refer this two links :
tuto services 1
tuto services 2
tuto services 3