This is a migrated thread and some comments may be shown as answers.

How to get the app icon?

1 Answer 39 Views
Google Android
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tulio
Top achievements
Rank 1
Tulio asked on 29 Jul 2013, 05:46 PM
Hi,
I´m currently creating a custom plugin that uses a AndroidService to play back a radio stream. I need to popup a notification to the user telling him that the radio is playing and when clicked show again the app.

Notification note = new Notification(ICON, "Listening now...", System.currentTimeMillis());
Intent i = new Intent(BackgroundAudioService.this, MyActivity.class);

How could I turn ICON in a resource? In a normal app in Eclipse, I could refer to R (class).
How could I find out which class is my activity?

Thanks in advance,

1 Answer, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 30 Jul 2013, 06:38 AM
Hello Tulio,

You can use this code from the PushPlugin that shows a notification correctly with the app icon.

As a side if you need to access the icon drawable you can use the following snippet:

context.getResources().getIdentifier("icon", "drawable", context.getPackageName());
where context is the application activity's context that can be retrieve in the plugin like this:
private Context getApplicationContext() {
    return this.cordova.getActivity().getApplicationContext();
}


Hope this helps,
Stefan Dobrev
Telerik

Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
Tags
Google Android
Asked by
Tulio
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Share this question
or