۱۳۹۴/۰۸/۲۸, ۱۱:۰۱ ب.ظ
۱۳۹۴/۰۸/۲۸, ۱۱:۳۸ ب.ظ
(۱۳۹۴/۰۸/۲۸, ۱۱:۰۱ ب.ظ)'mehran_ab' نوشته: [ -> ]سلام دوستان
یه نوتیفیکیشن دارم و میخوام وقتی روش کلیک شد یه سرویس را اندازی بشه .
چجوری از اینتنت باید استفاده کنم ؟
اینجوری؟
کد پیاچپی:
Intent in = new Intent(this , UrServ.class)
PendingIntent pe = PendingIntent.getService(this , 0 , in , in.FLAG_ACTIVITY_NEW_TASK)
NotiName.setContentIntent(pe)
نمیدونستم چجوری تو یه بلاک مخصوص کد بنویسمش
۱۳۹۴/۰۸/۲۸, ۱۱:۵۷ ب.ظ
خیلی ممنون
برای نوشتن به صورت کد اون بالا روی php بزن و توی اون بنویس .
برای نوشتن به صورت کد اون بالا روی php بزن و توی اون بنویس .
۱۳۹۴/۰۸/۲۹, ۱۲:۱۵ ق.ظ
یه سوال دیگه:
اگر بخوایم توی نوتیفیکیشن یه پروگرس بار مثلا برای دانلود نشون بدیم باید چیکار کنیم ؟
اگر بخوایم توی نوتیفیکیشن یه پروگرس بار مثلا برای دانلود نشون بدیم باید چیکار کنیم ؟
۱۳۹۴/۰۸/۲۹, ۰۱:۰۵ ق.ظ
(۱۳۹۴/۰۸/۲۸, ۱۱:۳۸ ب.ظ)'dmo' نوشته: [ -> ](۱۳۹۴/۰۸/۲۸, ۱۱:۰۱ ب.ظ)'mehran_ab' نوشته: [ -> ]سلام دوستاناینجوری؟
یه نوتیفیکیشن دارم و میخوام وقتی روش کلیک شد یه سرویس را اندازی بشه .
چجوری از اینتنت باید استفاده کنم ؟
نمیدونستم چجوری تو یه بلاک مخصوص کد بنویسمشکد پیاچپی:Intent in = new Intent(this , UrServ.class)
PendingIntent pe = PendingIntent.getService(this , 0 , in , in.FLAG_ACTIVITY_NEW_TASK)
NotiName.setContentIntent(pe)
متاسفانه کار نمیکنه
این فقط برای رفتن به یه اکتیویتی کار میکنه
۱۳۹۴/۰۸/۲۹, ۱۲:۱۸ ب.ظ
(۱۳۹۴/۰۸/۲۸, ۱۱:۰۱ ب.ظ)'mehran_ab' نوشته: [ -> ]سلام دوستان
یه نوتیفیکیشن دارم و میخوام وقتی روش کلیک شد یه سرویس راه اندازی بشه .
چجوری از اینتنت (Intent) باید استفاده کنم ؟
سلام.
لینک های زیر را ببینید :
http://stackoverflow.com/questions/23651...tion-click
http://stackoverflow.com/questions/64223...tification
۱۳۹۴/۰۸/۲۹, ۰۲:۵۸ ب.ظ
(۱۳۹۴/۰۸/۲۹, ۱۲:۱۸ ب.ظ)'admin' نوشته: [ -> ](۱۳۹۴/۰۸/۲۸, ۱۱:۰۱ ب.ظ)'mehran_ab' نوشته: [ -> ]سلام دوستان
یه نوتیفیکیشن دارم و میخوام وقتی روش کلیک شد یه سرویس راه اندازی بشه .
چجوری از اینتنت (Intent) باید استفاده کنم ؟
سلام.
لینک های زیر را ببینید :
http://stackoverflow.com/questions/23651...tion-click
http://stackoverflow.com/questions/64223...tification
واقعا ممنون ادمین جان منم این ها رو دیده بودم اما نمیدونم چجوری ازشون استفاده کنم
اینجوری استفاده کردم اما بازم کار نمیکنه :
کد پیاچپی:
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher) // notification icon
.setContentTitle(title) // title for notification
.setContentText(text) // message for notification
.setAutoCancel(false); // clear notification after click
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pi = PendingIntent.getService(this, 0, intent, Intent.FLAG_ACTIVITY_NEW_TASK);
mBuilder.setContentIntent(pi);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(0, mBuilder.build());
۱۳۹۴/۰۸/۲۹, ۰۷:۱۹ ب.ظ
دوستان خوشبختانه حل شد
از بردکاست رسیور استفاده کردم .
کد ها رو میزارم شاید بدرد بخوره :
متد آنکریت اکتیویتی اصلی :
کلاس رسیور :
اینم تگ رسیور داخل منی فست :
از بردکاست رسیور استفاده کردم .
کد ها رو میزارم شاید بدرد بخوره :
متد آنکریت اکتیویتی اصلی :
کد پیاچپی:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
NotificationManager notificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
Intent intent = new Intent(getApplicationContext(), BroadcastReceiver.class);
PendingIntent contentIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intent, 0);
Notification notification = new Notification(R.mipmap.ic_launcher, "developers.mehran.FIRST", System.currentTimeMillis());
notification.setLatestEventInfo(getApplicationContext(), "title first", "first", contentIntent);
notification.flags = Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, notification);
}
کلاس رسیور :
کد پیاچپی:
public class BroadcastReceiver extends android.content.BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setSmallIcon(R.mipmap.ic_launcher) // notification icon
.setContentTitle("Notification!") // title for notification
.setContentText("kelidestan.com") // message for notification
.setAutoCancel(false); // clear notification after click
Intent i = new Intent(context, MainActivity.class);
PendingIntent pi = PendingIntent.getActivity(context,0,i,Intent.FLAG_ACTIVITY_NEW_TASK);
mBuilder.setContentIntent(pi);
NotificationManager mNotificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(0, mBuilder.build());
}
}
اینم تگ رسیور داخل منی فست :
کد پیاچپی:
<receiver android:name=".BroadcastReceiver">
<intent-filter>
<action android:name="developers.mehran.FIRST"/>
</intent-filter>
</receiver>