Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5455] Android Local Notification restart

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionDone
Resolution Date2017-12-15T21:56:29.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterMarian Kucharcik
AssigneeShak Hossain
Created2017-12-15T09:03:03.000+0000
Updated2017-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

Comments

  1. Marian Kucharcik 2017-12-15

    I solved this issue by addidng
       <property name="ti.android.bug2373.finishfalseroot" type="bool">true</property>
       
    to tiapp.xml([According to documentation](http://docs.appcelerator.com/platform/latest/#!/guide/tiapp.xml_and_timodule.xml_Reference) it should be default value...)

JSON Source