[AC-5455] Android Local Notification restart
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Done |
Resolution Date | 2017-12-15T21:56:29.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Marian Kucharcik |
Assignee | Shak Hossain |
Created | 2017-12-15T09:03:03.000+0000 |
Updated | 2017-12-15T21:56:29.000+0000 |
Description
Hi guys,
I'm facing a problem(on Android 6.0.1).
Let's say I have app with id=com.example.exampleApp and when starting activity is .ExampleappActivity.
I implemented local notifications, notification will show up, but when I click on in, I get this error:
TiLaunchActivity: (main) [14972,34290] Android issue 2373 detected (missing intent CATEGORY_LAUNCHER or FLAG_ACTIVITY_RESET_TASK_IF_NEEDED), restarting app.
I create notification and intents like this(from documentation's example):
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_MAIN,
// Substitute the correct class name for your application
className: 'com.example.exampleApp.ExampleappActivity',
// Substitue the correct package name for your application
packageName: ''com.example.exampleApp',
});
intent.flags |= Ti.Android.FLAG_ACTIVITY_CLEAR_TOP | Ti.Android.FLAG_ACTIVITY_NEW_TASK;
intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
// Create a PendingIntent to tie together the Activity and Intent
var pending = Titanium.Android.createPendingIntent({
intent: intent,
flags: Titanium.Android.FLAG_UPDATE_CURRENT
});
// Create the notification
var notification = Titanium.Android.createNotification({
// icon is passed as an Android resource ID -- see Ti.App.Android.R.
icon: Ti.App.Android.R.drawable.icon,
contentTitle: 'Something Happened',
contentText : 'Click to return to the application.',
contentIntent: pending
});
// Send the notification.
Titanium.Android.NotificationManager.notify(1, notification);
When I click on the notification, I get restart is needed dialog and restart loop(app won't start correctly).
Have you please some advice what to do to avoid this?
Thank you
I solved this issue by addidng
to tiapp.xml([According to documentation](http://docs.appcelerator.com/platform/latest/#!/guide/tiapp.xml_and_timodule.xml_Reference) it should be default value...)