How to get the app icon?

2 posts, 0 answers
  1. Tulio
    Tulio avatar
    1 posts
    Member since:
    Jun 2013

    Posted 29 Jul 2013 Link to this post

    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,
  2. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 30 Jul 2013 Link to this post

    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.
Back to Top