React Native Push Notifications not coming in the notification pane in Android - android

I am trying the push notification for the first time. I followed a tutorial. After running the code, I send a test push notification from Firebase. The notification is appearing in the console log but its not coming in the notification pane.
My code is as follows:
RemotePushNotification.js
import React, { useEffect } from 'react'
import PushNotification from 'react-native-push-notification'
const RemotePushController = () => {
useEffect(() => {
PushNotification.configure({
// (optional) Called when Token is generated (iOS and Android)
onRegister: function (token) {
console.log('TOKEN:', token)
},
// (required) Called when a remote or local notification is opened or received
onNotification: function (notification) {
console.log('REMOTE NOTIFICATION ==>', notification)
})
// process the notification here
},
// Android only: GCM or FCM Sender ID
senderID: '############',
popInitialNotification: true,
requestPermissions: true
})
}, [])
return null
}
export default RemotePushController
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app3">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission
android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<!-- < Only if you're using GCM or localNotificationSchedule() > -->
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:name=".MainApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_name"
android:value="YOUR NOTIFICATION CHANNEL NAME"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description"
android:value="YOUR NOTIFICATION CHANNEL DESCRIPTION"/>
<!-- Change the resource name to your App's accent color - or any other color you want -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="#android:color/white"/>
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
</manifest>
This is the console log
REMOTE NOTIFICATION ==> {"channelId": "fcm_fallback_notification_channel", "color": null, "data": {}, "finish": [Function finish], "foreground": true, "id": "1987265985", "message": "fwafwaawf", "priority": "high", "sound": null, "tag": "campaign_collapse_key_4557183047135736330", "title": "fawfaf", "userInteraction": false, "visibility": "private"}

I believe you have to create a channel management for android.
https://github.com/zo0r/react-native-push-notification#channel-management-android.
Go through above link you will get to know since few months back they have updated it
Add below line in I am trying the push notification for the first time. I followed a tutorial. After running the code, I send a test push notification from Firebase. The notification is appearing in the console log but its not coming in the notification pane.
My code is as follows: AndroidManifest.xml
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="#string/default_notification_channel_id" />
Hopefully you will receive notification

Related

React native, registerHeadlessTask does not call my function

The notification appears on the top (The app is running....) but the function is not getting called. I can't find any error. Anyone knows what might be causing the issue?
I create a package and add it like this packages.add(new BackgroundPackage());
This is my index.js
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
const MyHeadlessTask = async () => {
console.log('Should be headless');//<--this is not getting called
};
AppRegistry.registerHeadlessTask('Background', () => MyHeadlessTask);//<<--this
AppRegistry.registerComponent(appName, () => App);
This is my AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.printerandroid">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application
android:name=".MainApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="com.printerandroid.BackgroundService" >
</service>
<service android:name="com.printerandroid.BackgroundEventService"/>
<receiver
android:name="com.printerandroid.BootUpReceiver"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>
You must register component like this
function MyHeadlessTask({ isHeadless }) {
if (isHeadless) {
// App has been launched in the background by iOS, ignore
return null;
}
return <App />;
}
function App() {
// Your application
}
AppRegistry.registerComponent('app', () => MyHeadlessTask);
Also, don't forget to make the changes as mentioned here.

handshakeexception handshake error in client (os error wrong_version_number tls_record cc 242) Flutter app/Node server

I'm getting an handshakeexception handshake error in client (os error wrong_version_number tls_record cc 242) error whenever making an http request( I also tried https ) but from only one ( Cyclist app ) of the two Flutter apps that connect to Node.js server. I'm using the same IP address and port on both, the Android tablet on which I'm testing both apps and for my machine. I checked Manifest Android/src/main/AndroidManifest.xml to see if I was using android:usesCleartextTraffic="true"`on the working app ( Shop app ) but I'm not..
What else could I check to see what's causing the error in the Cyclist app??
This is the request:
Map<String, String> headers = {
'Content-Type': 'application/json',
'api_key': Environment.dbApiKey
};
// final Uri uri = Uri.https(Environment.dbUrl, '/api/routes');
final Uri uri = Uri.http(Environment.dbUrl, '/api/routes');
await post(uri, headers: headers, body: jsonEncode(route.toMap()))
.then((resp) {
print(
'RouteMongoRepository.saveRoute response status code is: ${resp
.statusCode}, \n response is : ${jsonDecode(resp.body)}');
UserRoute saved = UserRoute.fromMap(jsonDecode(resp.body)['data']);
print('saved route to Mongo is : ${saved.toMap().toString()}');
}) .catchError((e) => print('RouteMongoRepository.saveRoute error: $e')) ;
This is the Shop app manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vinny.fixit_shop_flutter">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="io.flutter.app.FlutterApplication"
android:allowBackup="false"
android:label="fixit shop"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
and this is the Cyclist app manifest:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:name="io.flutter.app.FlutterApplication"
android:allowBackup="false"
android:label="fixit"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
</intent-filter>
</receiver>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
Found it..I was missing <uses-permission android:name="android.permission.INTERNET" />in Cyclist app AndroidManifest.xml

Android custom notification sound for FCM in Flutter not working when changing to targetSdkVersion 28

I have a custom notification sound for FCM in my Flutter App working properly when I set the targetSdkVersion to 25 but once I change the targetSdkVersion to 28 default sound is played instead.
I'm using plugin firebase_messaging 6.0.9
This is my AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="*********">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:name=".Application"
android:label="*****"
android:icon="#mipmap/ic_launcher">
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="*********"/>
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="#mipmap/ic_notification"
/>
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
And this is my payload:
public function toFcm($notifiable)
{
$message = new FcmMessage();
$notification = [
'title' => "Nouvelle commande #".$this->order->id." pour ".$this->order->foodOrders[0]->food->restaurant->name,
'body' => $this->order->user->name,
'icon' => $this->order->foodOrders[0]->food->restaurant->getFirstMediaUrl('image', 'thumb'),
'sound' => 'sale.wav', // Optional
'click_action' => "FLUTTER_NOTIFICATION_CLICK",
'id' => '1',
'status' => 'done',
];
$message->content($notification)->data($notification)->priority(FcmMessage::PRIORITY_HIGH);
return $message;
}
I'm not sure what I'm missing, thanks for your help!

Parse server notifications for android not logging in GCM and not received on device

I'm new to android so please bear with me.
I've tried my very best to configure parse server (on Heroku) to send notifications to my android app and I've (hopefully) appropriately configured AndroidManifest.xml as well (see below).
When I send a notification using parse dashboard it seems to suggest that it has been sent in the Heroku logs (i'm not developing for iOS hence the error on the second line):
Heroku Logs:
2016-11-16T20:33:29.713489+00:00 heroku[router]: at=info method=POST path="/parse/push" host=heartofengland.herokuapp.com request_id=03ac09c2-3209-4d12-a7eb-e2e7f72e2dde fwd="104.238.169.124" dyno=web.1 connect=0ms service=7ms status=200 bytes=482
2016-11-16T20:33:29.761488+00:00 app[web.1]: Can not find sender for push type ios, {"where":{},"data":{"alert":"Test message"}}
The issue is however nothing logs in GCM nor do i get a notification on my device.
From the numerous guides I have followed, they would all seem to suggest I have configured parse and AndroidManifest.xml correctly - obviously I seem to be missing something (See below).
Any ideas as to what I'm doing wrong?
Thanks in advance
Parse index.js:
// Example express application adding the parse-server module to expose Parse
// compatible API routes.
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI;
if (!databaseUri) {
console.log('DATABASE_URI not specified, falling back to localhost.');
}
var api = new ParseServer({
databaseURI: databaseUri || '',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || '',
masterKey: process.env.MASTER_KEY || '',
serverURL: process.env.SERVER_URL || '',
push: {
android: {
senderId: 'XXXXXXXXXX', //Obscured for security
apiKey: 'XXXXXXXXXXXXXXXX'
}
}
});
var app = express();
// Serve the Parse API on the /parse URL prefix
var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);
// Parse Server plays nicely with the rest of your web routes
app.get('/', function(req, res) {
res.status(200).send('I dream of being a web site.');
});
var port = process.env.PORT || 1337;
app.listen(port, function() {
console.log('parse-server-example running on port ' + port + '.');
});
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="uk.co.alexwoodhouse.drawview.drawviewtest">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<permission android:protectionLevel="signature" android:name="${packageName}.permission.C2D_MESSAGE" />
<uses-permission android:name="${packageName}.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data android:name="com.parse.push.gcm_sender_id"
android:value="#string/gcm_sender_id"/>
<receiver android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="${packageName}" />
</intent-filter>
</receiver>
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParsePushBroadcastReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<activity
android:name=".MainActivity"
android:label="Heart of England"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".TimeTable"
android:label="Timetable"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".Twitter"
android:label="Twitter Feed" />
<activity
android:name=".Emails"
android:label="School Email"></activity>
</application>
</manifest>

Appcelerator UrbanAirship and android (launch app)

I am using UrbanAirship module in my Appcelerator project to receive push notifications. I am receiving push notifications but when a user clicks on a notification from their notification center on their android device the app doesn't launch. It does on the iPhone though. Any ideas how to fix this?
Thanks.
Update
Below is the code used to subscribe to push notification on the android
UrbanAirship = require("ti.urbanairship")
Ti.API.log "UrbanAirship.pushEnabled " + UrbanAirship.pushEnabled
Ti.API.log "UrbanAirship.pushId " + UrbanAirship.pushId
UrbanAirship.options =
PRODUCTION_APP_KEY: "XXXX"
PRODUCTION_APP_SECRET: "XXXX"
DEVELOPMENT_APP_KEY: "XXXX"
DEVELOPMENT_APP_SECRET: "XXXX"
LOGGING_ENABLED: true
UrbanAirship.addEventListener UrbanAirship.EVENT_URBAN_AIRSHIP_CALLBACK, (e) ->
Ti.API.info "UrbanAirship: Received message " + e.message
alert e.message
UrbanAirship.addEventListener UrbanAirship.EVENT_URBAN_AIRSHIP_SUCCESS, (e) ->
token = e.deviceToken
Ti.App.Properties.setString "device_token", token
Ti.API.info "UrbanAirship: Received device token " + token
UrbanAirship.addEventListener UrbanAirship.EVENT_URBAN_AIRSHIP_ERROR, (e) ->
Ti.API.info "UrbanAirship: Error " + e.error
UrbanAirship.pushEnabled = true
And on the server side:
notification = {"android" => {"alert" => message}, "apids" => android_device_tokens}
Urbanairship.push(notification)
Here is the android related code in the tiapp.xml
<property name="ti.android.debug" type="bool">true</property>
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest android:installLocation="preferExternal"
android:versionCode="10" android:versionName="1.0.6"/>
<manifest>
<supports-screens android:anyDensity="false"/>
<application>
<activity
android:configChanges="keyboardHidden|orientation"
android:name="org.appcelerator.titanium.TiActivity" android:screenOrientation="portrait"/>
</application>
</manifest>
</android>
Below is the airshipconfig.properties
developmentAppKey = xxx
developmentAppSecret = xxx
productionAppKey = xxx
productionAppSecret = xxx
transport = c2dm
c2dmSender = xxxx#gmail.com
inProduction = true
iapEnabled = false
And here is the auto generated AndroidManifest.xml
<?xml version="1.0" ?>
<manifest android:installLocation="preferExternal" android:versionCode="10" android:versionName="1.0.6" package="com.batmanadventure" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="false"/>
<uses-sdk android:minSdkVersion="8"/>
<permission android:name="com.batmanadventure.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<application android:debuggable="false" android:icon="#drawable/appicon" android:label="BatmanAdventure" android:name="BatmanadventureApplication">
<activity android:configChanges="keyboardHidden|orientation" android:name="org.appcelerator.titanium.TiActivity" android:screenOrientation="portrait"/>
<receiver android:name="com.urbanairship.CoreReceiver">
<!-- REQUIRED IntentFilter - For Helium and Hybrid -->
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.ACTION_SHUTDOWN"/>
</intent-filter>
</receiver>
<receiver android:name="com.urbanairship.push.c2dm.C2DMPushReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<!-- Receive the actuggal message -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="com.batmanadventure"/>
</intent-filter>
<!-- Receive the registration id -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
<category android:name="com.batmanadventure"/>
</intent-filter>
</receiver>
<service android:name="com.urbanairship.push.PushService"/>
<receiver android:name="ti.modules.titanium.urbanairship.IntentReceiver"/>
<activity android:configChanges="keyboardHidden|orientation" android:label="BatmanAdventure" android:name=".BatmanadventureActivity" android:theme="#style/Theme.Titanium">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:configChanges="keyboardHidden|orientation" android:name="org.appcelerator.titanium.TiTranslucentActivity" android:theme="#android:style/Theme.Translucent"/>
<activity android:configChanges="keyboardHidden|orientation" android:name="org.appcelerator.titanium.TiModalActivity" android:theme="#android:style/Theme.Translucent"/>
<activity android:configChanges="keyboardHidden|orientation" android:name="ti.modules.titanium.ui.TiTabActivity"/>
<activity android:name="ti.modules.titanium.ui.android.TiPreferencesActivity"/>
<service android:exported="false" android:name="org.appcelerator.titanium.analytics.TiAnalyticsService"/>
</application>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.batmanadventure.permission.C2D_MESSAGE"/>
</manifest>
Firstly, it surely is not a problem with urbanairship library. Because urbanairship won't miss on something this basic.
Check Custom Handling of Push Events
Here, the launch of activity is being handled a little differently by checking for PushManager.ACTION_NOTIFICATION_OPENED and then calling UAirship.shared().getApplicationContext().startActivity(launch);
In your ti.modules.titanium.urbanairship.IntentReceiver
public class IntentReceiver extends BroadcastReceiver {
private static final String logTag = "PushSample";
#Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(PushManager.ACTION_NOTIFICATION_OPENED)) {
Log.i(logTag, "User clicked notification. Message: " + intent.getStringExtra(PushManager.EXTRA_ALERT));
logPushExtras(intent);
Intent launch = new Intent(Intent.ACTION_MAIN);
launch.setClass(UAirship.shared().getApplicationContext(), MainActivity.class);
launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
UAirship.shared().getApplicationContext().startActivity(launch);
}
}
You can set the activity to be launched in launch.setClass(UAirship.shared().getApplicationContext(),MainActivity.class);
It could be a problem with urbanairship library. If they did not add a PendingIntent to the notification, it will not open your app.
I just looked at urbanairship.com but it does not seem they provide source code for Android, only the jar.

Categories

Resources