I have a Service
which listening the socket and when data came creating a notification. When users click the notification starting MainActivity
, but I don't want to start an intent I just want to open app and continue. Because I am showing a map in MainActivity
and when I started MainActivity
with an intent it triggers OnMapReady
function again.
You must look for android:launchMode
tag. Please refer this page : activity-element
For instance in your AndroidManifest.xml :
<activity
android:name=".activity.YasinActivity"
android:configChanges="screenLayout|screenSize|orientation"
android:label="blabla"
android:launchMode="singleTask"
android:theme="@style/AppTheme"
android:windowSoftInputMode="stateAlwaysHidden" />
Try with adding this flag into your PendingIntent PendingIntent.FLAG_UPDATE_CURRENT
eg:
PendingIntent.getActivity(this, 0, new Intent(this, YourActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
It opens your application without reloading if app is having background and when your app is destroyed it reloads the app.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.