How to use AdView inside the remoteview notification android? -
i want create custom notification view google ads.
this code want implement remoteviews.
remoteviews views = new remoteviews(context.getpackagename(), r.layout.notification_view); publisheradview mpublisheradview = (publisheradview) findviewbyid(r.id.publisheradview); views.setviewvisibility(r.id.publisheradview, view.visible); publisheradrequest adrequest = new publisheradrequest.builder().build(); mpublisheradview.loadad(adrequest); intent notificationintent = new intent(this, mainactivity.class); notificationintent.setaction(syncstatecontract.constants.action.main_action); notificationintent.setflags(intent.flag_activity_new_task | intent.flag_activity_clear_task); pendingintent pendingintent = pendingintent.getactivity(this, 0, notificationintent, 0);
with below code -
remoteviews views = new remoteviews(context.getpackagename(), r.layout.notification_view);
i can custom layout notification (r.layout.notification_view).
but can't link publisheradview remoteviews. publisheradview code-
publisheradview mpublisheradview = (publisheradview) findviewbyid(r.id.publisheradview); views.setviewvisibility(r.id.publisheradview, view.visible); publisheradrequest adrequest = new publisheradrequest.builder().build(); mpublisheradview.loadad(adrequest);
============
i trying use like:
publisheradview mpublisheradview = (publisheradview) views.findviewbyid(r.id.publisheradview); views.setviewvisibility(r.id.publisheradview, view.visible); publisheradrequest adrequest = new publisheradrequest.builder().build(); mpublisheradview.loadad(adrequest);
but getting method not found error in line.
views.findviewbyid(r.id.publisheradview);
please me same. or there other way implement ads inside notification pan (notification tray).
Comments
Post a Comment