Google Plus +1 button inside app?


#1

Hi,

I’ve added a +1 button in my app:

I’ve used this code:
<div class="g-plusone" data-size="tall" data-href="GOOGLE PLAY STORE LINK TO MY APP"></div>
and
(function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/platform.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })();

I’ve also allowed the api:
index.html:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://apis.google.com">
config.xml:
<allow-navigation href="https://apis.google.com" />

The problem:
This works on the web (ionic serve) but It doesn’t work on the app…
When I click nothing happens… (no errors…)
Anyway I can make this work or there’s any other way to do it?

Note: If I’ve clicked +1 on the web it doesn’t show me the red button on the app (It doesn’t know who I am…)
Note 2: I don’t want to make a login/signup, just a +1 button…

Thanks for your help!


#2

Hi people!

More information:
If I add:
<allow-navigation href="*" />
to config.xml
This happens when I click the +1 button:

(This means the +1 button doesn’t work because is “in an anonymous browser”, not authenticated with the OS)

I also created a demo app following this instructions: https://developers.google.com/+/mobile/android/recommend
It works perfectly…

My two possibilites:

  1. Some way to make a native Android view with the +1 button appear on the webview.
  2. Make a fake +1 button and when it’s clicked it calls a plugin that makes some king of request/click on the real +1 button…

Are any of these two possibilities possible?

Thanks for your help!


#3

Since no one answered this question I’ve opened an stackoverflow bounty: (300 points)
http://stackoverflow.com/questions/35541290/how-to-place-a-google-plus-1-button-inside-cordova-ionic-app


#4

In the las 15 minutes of the bounty an angel appeared and found a solution!

How do I mark this forum thread as solved?