tux-world
دوشنبه 26 آبان 1393, 19:18 عصر
با سلام. اینکه شما هم مسلما نرم افزارهایی مثل Gosms رو دیدین که در صورتی که پیام جدید بیاد LED گوشی رو روشن میکنه به رنگهای مختلف هم میشه اون رو ست کرد. برای یکی از پروژه هام این مورد رو لازم داشتم و اینجا گفتم یاد بدم که بتونین ازش استفاده کنید.
برای اینکار شما باید حتما پرمیژن رو هم ست کرده باشید و از کد زیر استفاده کنید
Notification notification = new Notification(R.drawable.tsms_icon, "سایت آموزشی جزیره", System.currentTimeMillis ());
notification.flags |= Notification.FLAG_AUTO_CANCEL;
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTI FICATION_SERVICE);
Intent notificationIntent = new Intent(getBaseContext (), ActivityMain.class);
PendingIntent contentIntent = PendingIntent.getActivity(getBaseContext (), 0, notificationIntent, 0);
notification.contentIntent = contentIntent;
RemoteViews contentView = new RemoteViews(getBaseContext ().getPackageName(), R.layout.notification);
contentView.setImageViewResource(R.id.notification _icon, R.drawable.tsms_icon);
contentView.setTextViewText(R.id.notification_titl e,
G.context.getString ( R.string.have_new_sms ));
notification.contentView = contentView;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notification.ledARGB = 0xffffff00;
notification.ledOnMS = 300;
notification.ledOffMS = 2000;
notificationManager.notify(G.NOTIFICATION_ID , notification);
رنگهایی هستش که شما میایید ست میکنید. چیز خاصی نداره و اگه نیازی به توضیح داشتید بپرسید. موفق باشید.
انگار این نمایش کدهای فروم مشکل داره. اینجا رو کلیک کنید (http://jaziire.ir/1393/08/26/%d8%a2%d9%85%d9%88%d8%b2%d8%b4-%d8%b1%d9%88%d8%b4%d9%86-%da%a9%d8%b1%d8%af%d9%86-%da%86%d8%b1%d8%a7%d8%ba-led-%d9%86%d8%a7%d8%aa%db%8c%d9%81%db%8c%da%a9%db%8c%d 8%b4%d9%86-%da%af%d9%88%d8%b4%db%8c/)
برای اینکار شما باید حتما پرمیژن رو هم ست کرده باشید و از کد زیر استفاده کنید
Notification notification = new Notification(R.drawable.tsms_icon, "سایت آموزشی جزیره", System.currentTimeMillis ());
notification.flags |= Notification.FLAG_AUTO_CANCEL;
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTI FICATION_SERVICE);
Intent notificationIntent = new Intent(getBaseContext (), ActivityMain.class);
PendingIntent contentIntent = PendingIntent.getActivity(getBaseContext (), 0, notificationIntent, 0);
notification.contentIntent = contentIntent;
RemoteViews contentView = new RemoteViews(getBaseContext ().getPackageName(), R.layout.notification);
contentView.setImageViewResource(R.id.notification _icon, R.drawable.tsms_icon);
contentView.setTextViewText(R.id.notification_titl e,
G.context.getString ( R.string.have_new_sms ));
notification.contentView = contentView;
notification.flags |= Notification.FLAG_SHOW_LIGHTS;
notification.ledARGB = 0xffffff00;
notification.ledOnMS = 300;
notification.ledOffMS = 2000;
notificationManager.notify(G.NOTIFICATION_ID , notification);
رنگهایی هستش که شما میایید ست میکنید. چیز خاصی نداره و اگه نیازی به توضیح داشتید بپرسید. موفق باشید.
انگار این نمایش کدهای فروم مشکل داره. اینجا رو کلیک کنید (http://jaziire.ir/1393/08/26/%d8%a2%d9%85%d9%88%d8%b2%d8%b4-%d8%b1%d9%88%d8%b4%d9%86-%da%a9%d8%b1%d8%af%d9%86-%da%86%d8%b1%d8%a7%d8%ba-led-%d9%86%d8%a7%d8%aa%db%8c%d9%81%db%8c%da%a9%db%8c%d 8%b4%d9%86-%da%af%d9%88%d8%b4%db%8c/)