Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any sample snippet to make it work for Android icon? #32

Closed
riyaz opened this issue Nov 9, 2016 · 5 comments
Closed

Any sample snippet to make it work for Android icon? #32

riyaz opened this issue Nov 9, 2016 · 5 comments

Comments

@riyaz
Copy link

riyaz commented Nov 9, 2016

I use badge with fastlane for Android, couldn't make it work, what's the right way?

      badge(dark: true, glob:"#{Dir.pwd}/../app/src/main/res/drawable-xxhdpi/launcher_icon.png")

@HazAT
Copy link
Owner

HazAT commented Nov 9, 2016

Should be correct ... just make sure the path really exists
Do something like

puts "#{Dir.pwd}/../app/src/main/res/drawable-xxhdpi/launcher_icon.png"
badge(dark: true, glob:"#{Dir.pwd}/../app/src/main/res/drawable-xxhdpi/launcher_icon.png")

And check the path ...

@riyaz
Copy link
Author

riyaz commented Nov 10, 2016

@HazAT I have verified file does exists and path is correct.

      puts File.exist?("#{Dir.pwd}/../app/src/main/res/drawable-xxhdpi/launcher_icon.png")
      puts "#{Dir.pwd}/../app/src/main/res/drawable-xxhdpi/launcher_icon.png"
      badge(dark: true, glob:"#{Dir.pwd}/../app/src/main/res/drawable-xxhdpi/launcher_icon.png")

@riyaz
Copy link
Author

riyaz commented Nov 10, 2016

Just to debug further I copied source from badge/lib/badge/runner.rb and it works fine, I mean it prints the full path of png without any issues, looks like its not working if we pass through fastlane

     app_icons = Dir.glob("#{Dir.pwd}/../app/src/main/res/drawable-xxhdpi/launcher_icon.png")
      puts app_icons.count
      app_icons.each do |full_path|
         icon_path = Pathname.new(full_path)
         puts icon_path
       end

@riyaz riyaz closed this as completed Nov 10, 2016
@riyaz riyaz reopened this Nov 10, 2016
@khanghoang
Copy link

@riyaz mine is

    badge(
      custom: "./logo.png",
      dark: true,
      glob: "/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png",
    )

Please notice the custom one

@riyaz
Copy link
Author

riyaz commented Nov 10, 2016

@khanghoang thanks for the hint, issue is with the path which starts with /, I was giving absolute path which is not working, below snippet works fine

      badge(dark: true, glob:"/app/src/main/res/drawable-xxhdpi/launcher_icon.png")

@riyaz riyaz closed this as completed Nov 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants