Open andreszs opened 9 years ago
The following steps worked for me:
platforms/android/src/com/plugin/gcm/GCMIntentService.java
the line to import the R
generated by cordova, import com.myapp.www.R;
- not the R
from android. noticon.png
to ./platforms/android/ant-build/res/drawable/
setSmallIcon(R.drawable.noticon);
There must be a better way to do this than what I did however. Defaulting to setSmallIcon(context.getApplicationInfo().icon)
, as PushPlugin does right now, is not desirable in many cases. Many developers want their application's icon to be different from the notification's icon. This seems like a normal requirement inasmuch as many application icons are in color, while notification icons need to be entirely white.
So I don't know what the right answer is right now.
This is a real problem if your target SDK is Lollipop because it allows only flat icons, and turn your icon to white. So we most definitely need an option to choose custom notification icon.
@adamsc64 Step 2 isn't correct. The noticon.png should be copied into ./platforms/android/res/drawable Regards, patrick
I've added an Image asset to the resources in Android Studio, with the Notification icon type (so it makes correct silhouettes).
And the following code:
.setSmallIcon(context.getResources().getIdentifier("ic_stat_name", "drawable", context.getPackageName()))
@barryvdh where do you add the setSmallIcon code in Android Studio?
In one of the source files, where they add the icon. But https://github.com/phonegap/phonegap-plugin-push solved my problems better :)
I want to set my white icon for the notification bar, and I tried all possible options so far:
And placed noticon.png on: MyApp\plugins\com.phonegap.plugins.PushPlugin\src\android\res\drawable-hdpi + all other drawable dirs MyApp\platforms\android\res\drawable + all other drawable dirs
I keep getting the default, colored icon instead my white noticon.png. Any help will be appreciated, thanks.