Build APP using specific keys via Phonegap Build API? - php

I'm trying to use Phonegap Build API.
I am using this open source PHP library to connect to the Phonegap plugin.
https://github.com/mradionov/phonegap-build-api
Everything works fine as it should.
I can add keys, upload apps and all other general tasks.
However, the issue that I currently have is that I need to be able to upload the app and build it using a specific key for each platform.
To upload the app I use this method:
$res = $api->updateApplicationFromFile(3334534, 'path/to/myapp.zip', array(
'title' => 'The APP title',
// see docs for all options
));
This uploads it correctly and as it should.
Now, i tried to upload the app using the same method but select a specific key to build it with like so:
$res = $api->updateApplicationFromFile(3334534, 'path/to/myapp.zip',
'title' => 'The APP title',
'keys' => 1435671
// see docs for all options
));
But this fails to do anything and I dont see any errors either!
Based on the Phonegap API documentation, we can send the following to the API:
keys":{"ios":123,"android":567,"winphone":72}
the numbers used are the keys/certficates that already uploaded onto the Phonegap system.
Could someone please advice on this issue?
Thanks in advance.

finally found it.
Basically I need to pass the values as an array like so:
'keys' => array("ios" => XXXXXXX, "android" => XXXXXXXX),
So the code looks like this:
$res = $api->updateApplicationFromFile(3334534, 'path/to/myapp.zip',
'title' => 'The APP title',
'keys' => array("ios" => XXXXXXX, "android" => XXXXXXXX),
// see docs for all options
));
And this works just fine...
Hoep this helps others.

Related

Is it possible to get number of downloads of an application from Google Play?

I am trying to get the number of downloads of an application that I have uploaded to Google Play.
I am searching for an API (or something similar) that retrieves to me the number of downloads with the authentification of the user. I do not want third party applications (like AppAnnie).
It would be great if it could be on PHP and I found that there is a library which I think it is the most closest API I could find to get data from Google applications.
Google APIs Client Library for PHP
but I cannot find any mention to Google Play applications.
Is there some way to get the downloads of an specific application having the authentification keys?
Thanks in advance!
Use the google-play-scraper library to get an app information as below:
Example:
$app = $scraper->getApp('com.mojang.minecraftpe');
Result:
array (
'id' => 'com.mojang.minecraftpe',
'url' => 'https://play.google.com/store/apps/details?id=com.mojang.minecraftpe',
'image' => 'https://lh3.googleusercontent.com/30koN0eGl-LHqvUZrCj9HT4qVPQdvN508p2wuhaWUnqKeCp6nrs9QW8v6IVGvGNauA=w300',
'title' => 'Minecraft: Pocket Edition',
'author' => 'Mojang',
'author_link' => 'https://play.google.com/store/apps/developer?id=Mojang',
'categories' => array (
'Arcade',
'Creativity',
),
'price' => '$6.99',
'screenshots' => array (
'https://lh3.googleusercontent.com/VkLE0e0EDuRID6jdTE97cC8BomcDReJtZOem9Jlb14jw9O7ytAGvE-2pLqvoSJ7w3IdK=h310',
'https://lh3.googleusercontent.com/28b1vxJQe916wOaSVB4CmcnDujk8M2SNaCwqtQ4cUS0wYKYn9kCYeqxX0uyI2X-nQv0=h310',
// [...]
),
'description' => 'Our latest free update includes the Nether and all its inhabitants[...]',
'description_html' => 'Our latest free update includes the Nether and all its inhabitants[...]',
'rating' => 4.4726405143737793,
'votes' => 1136962,
'last_updated' => 'October 22, 2015',
'size' => 'Varies with device',
'downloads' => '10,000,000 - 50,000,000',
'version' => 'Varies with device',
'supported_os' => 'Varies with device',
'content_rating' => 'Everyone 10+',
'whatsnew' => 'Build, explore and survive on the go with Minecraft: Pocket Edition[...]',
'video_link' => 'https://www.youtube.com/embed/D2Z9oKTzzrM?ps=play&vq=large&rel=0&autohide=1&showinfo=0&autoplay=1',
'video_image' => 'https://i.ytimg.com/vi/D2Z9oKTzzrM/hqdefault.jpg',
)
EDIT: Easily get downloads count as below:
echo $app['downloads']; // Outputs: '10,000,000 - 50,000,000'
Or if you want the left value:
$matches = null;
$returnValue = preg_match('/.*(?= -)/', '10,000,000 - 50,000,000', $matches);
echo $matches[0]; // Outputs: '10,000,000'
Or if you want the right value:
$matches = null;
$returnValue = preg_match('/(?<=- ).*/', '10,000,000 - 50,000,000', $matches);
echo $matches[0]; // Outputs: '50,000,000'
Then easily convert it to integer using:
$count = null;
$returnValue = (int)preg_replace('/,/', '', $matches[0], -1, $count);
echo $returnValue; // Outputs: 10000000 or 50000000
This is about meta data api. You can look at below.
https://developers.google.com/android-publisher/api-ref/reviews
You need to Scrape it. Generally speaking, & of course in this particular case, when the website(here: Google Play) does not provide an API to make your(client's) desired data accessible to him, Web scraping is one of the best methods to gather your required information.
Nearly every piece of information that you can see on a web page, can be scraped. Nowadays with great improvements of web scrapers, not only you are able to grab data from a target website, but also "crawling it like a user", "posting information to website via forms", "logging in as a user" & etc. has become a routine for any web scraper.
There are very strong scrapers out there, like Scrapy(likely the most reputed one, written in Python) almost for every language. AFAIK the best web scraper in PHP, is Goutte written by legendary #fabpot from FriendsOfPHP.
From the Data-Extraction POV, Goutte supports both "CSS Selectors" & XPath (Because it uses Symfony's DOM Crawler as Crawling engine). So you can crawl the document the way you want to extract every piece of information in any hidden corner of a web page!
You can go faraway in scraping with Goutte, But just as a tiny example for grabbing "number of installs" from an ordinary App page in a blink of an eye:
use Goutte\Client;
$Client = new Client();
/**
* #var \Symfony\Component\DomCrawler\Crawler
*/
$Crawler = $Client->request('GET', "https://play.google.com/store/apps/details?id=com.somago.brainoperator&hl=en");
$numberOfInstalls = $Crawler->filter('div.details-section-contents div.meta-info')->eq(1)->filter('div.content')->eq(0)->text();
echo $numberOfInstalls;
It will simply print Brain Operator game's "number of downloads".
This project https://github.com/ArcadiaConsulting/appstorestats is a API in Java to get statistics from Google Play and AppStore
checkout this library 42 matters gives number of downloads , rating many more
With AppID you can get it from the GooglePlay API
Or if the app is yours you can export the statistics from Google Cloud (reference)
In python you can use this.
from google_play_scraper import app #if not installed google_play_scraper then install by **pip install google-play-scraper**
playstore = app('test.example.com');
print(playstore):

Facebook Ads API - Can't Edit Audience

I'm trying to create custom audience & followed the instructions given here.
This is the code I've used.
$audience = new CustomAudience(null, 'act_'.$account_id);
$aud_data = array(
CustomAudienceFields::NAME => $name,
CustomAudienceFields::SUBTYPE => CustomAudienceSubtypes::WEBSITE,
CustomAudienceFields::RULE => array('event' => array('i_contains' => $name ) ),
CustomAudienceFields::PIXEL_ID => $pixelId,
CustomAUdienceFields::DESCRIPTION => '',
CustomAudienceFields::RETENTION_DAYS => 180,
CustomAudienceFields::PREFILL => True
);
$audience->setData($aud_data);
$create = $audience->create();
The custom audience is being created successfully but on dashboard it is giving the error 'Can't Edit the Audience' as shown in screenshot below.
I don't understand this error. I'm using the latest API, why would it use old settings? Also, this is not what I want, I want to create a 'Custom Combination Audience' which is available through dashboard but not through API. Basically, I'm trying to emulate this (screenshot) through API. I'm using PHP Ads SDK 2.5
1) You're rule should be a JSON string.
CustomAudienceFields::RULE => '{"and": [{"event": {"i_contains": "ViewContent"}},{"content_name": {"i_contains": "'.$name.'"}}]}'
2) Facebook doesn't support that type via the current Marketing API (v2.11):
https://developers.facebook.com/docs/marketing-api/reference/custom-audience/
Type of custom audience, derived from original data source.
Note: COMBINATION subtype is only used by Power Editor and Ads Manager, and not available through the API.

ALL GCM parameters?

i´ve written a "pushserver" for my app via PHP.
The push notifications i´ve sent via PHP are all received on the device, so far.
But, i can just send/set the "message" and "title", see:
$fields = array(
'registration_ids' => $registrationIDs,
'data' => array(
'message' => $message,
'title' => 'My App',
'vibrate' => 1,
'sound' => 1,
'icon' => "http://example.com/image.jpg",
"style" => "inbox"
),
);
"icon" and "style" are not working (vibrate and sound not tested, yet).
Every link for the parameters i´ve found is broken or kind of "you need to do object.setSomething() in JAVA.
Is there a list anywhere where i can see ALL parameters, which i can send to GCM? No matter, what language i use?
Cheers,
Chris
couple of things need to keep in mind while all the data which you sending from server end
Is there a list anywhere where i can see ALL parameters,
exp :- you can send as many parameters as you want but offcourse there is limitation but not key specific just like you can use "textmessage" instead of "message" but make sure to retrieve the value from same key which you are assigning from server end
1) please make sure that you are getting all the data in gcmintentservice class try to print the log of all intent data.
please remember that this is just a string data it is not going to download the image for you. you have to download using volley library or any suitable library

Privacy setting does not change when using Vimeo API

The video uploaded via the new API used the "video name" but the privacy setting doesn't change (I need it to be disabled from vimeo.com but can be embedded from other sites).
$video_data = $vimeo->request($uri, array(
'name' => 'video name',
'privacy' => array(
'view' => 'disabled',
'embed' => 'anywhere'
)
), 'PATCH');
Does anyone know why it's not working?
I find an alternative way to do this by changing the global defaul settings: https://vimeo.com/settings/videos
Many thanks
The correct request is:
// The docs refer to the following as "privacy.view"
array('privacy' => array('view' => 'disable'));
From https://github.com/vimeo/vimeo.php:
NOTE: How to use the PHP library with the Vimeo Docs.
The API docs often uses dot notation to represent a hierarchy of data (eg. privacy.view). Because this library sends all data using JSON, you must use nested associative arrays, not dot notation.
The value is "disable" not "disabled". You can see our docs here

hotmail: user authentication and contact retrieval with PHP

I am trying to write a PHP script that will allow me to do two things:
Allow users to use their Hotmail (I think its called 'Live' now?) account to authenticate themselves to a website
Retrieve an authenticated users contact list from Hotmail.
I have trawled the internet for the past 6 hours, looking for at least a working example that I can modify/extend to do the above two things. There are several dozens similar questions asked here on SO for example - NONE of the proffered answers work any more (admittedly, some of the questions were a few years old).
I tried the Microsoft site and downloaded the latest version of their API which seems to evolve at a rather alarming rate. I finally managed to track down an API which has not been deprecated (yet?).
I followed the instructions and when I attempted to authenticate, I was rewarded with the following mesage, for my efforts:
We're unable to complete your request
Windows Live ID is experiencing technical difficulties. Please try again later.
I immediately tried the online version of the demo and perhaps unsurprisingly, that worked like a charm.
As an aside, I managed to implement the same functionality for Yahoo and GMail, using their OPEN APIs, under an hour each. Now, it is possible that my unmitigated hatred of all things proprietary (sorry make that Microsoft), is causing me to lose the plot a little here.
Has anyone ACTUALLY (in 2012) managed to get a working sample in PHP that allows:
Hotmail (live?) user authentication
Hotmail user contact email retrieval
If you have, a code snippet, or a link to where I can find such a snippet would be very useful, as I have so far, wasted a whole afternoon trying to work the Microsoft Live API via PHP.
PS: No, I'm not interested in OpenInviter, its broken.
i wrote my own oauth library based around a single array for each service provider. this array contains all of the data required to perform authentication and retrieve user data. the array i use for msdn (ie. hotmail, outlook, xbox, msn) is:
$msdn = array
(
'oauth_version' => '2',
'oauth_method' => 'GET',
'redirect_user_params' => array
(
'url' => 'https://oauth.live.com/authorize',
'response_type' => 'code',
'http_params' => array
(
'url',
'client_id',
'redirect_uri',
'response_type',
'scope',
'state'
)
),
'obtain_access_token_params' => array
(
'url' => 'https://oauth.live.com/token',
'grant_type' => 'authorization_code',
'http_params' => array
(
'url',
'client_id',
'client_secret',
'code',
'grant_type',
'redirect_uri',
'scope'
)
),
'scope' => 'wl.signin wl.basic',
'obtain_user_data_params' => array
(
'url' => 'https://apis.live.net/v5.0/me',
'http_params' => array
(
'url',
'access_token',
'scope'
)
),
'client_id' => 'xxxxx', // = oauth_consumer_key in oauth 1.0 lingo
'client_secret' => 'xxxxxxxxxxxxxxx',
'readme_url' => 'http://msdn.microsoft.com/en-us/library/live/hh243647.aspx'
);
the parameters for each of the three oauth stages (ie "redirect user", "obtain access token" and "obtain user data") are in the http_params arrays. in the case of msdn these parameters end up in the query query string of the url that i send out with curl (since msdn only accepts GET, not POST).
i haven't tried retrieving the user's contact address book, but this would just be a case of extending the scope element with whatever extra information you require (documented here http://msdn.microsoft.com/en-us/library/live/hh243646.aspx). as you can see from the http_params arrays, the scope parameter is used in each of the three oauth stages.
Try out a Hotmail/MSN/Live import on the CloudSponge test drive to see if that's the user experience you're hoping for.
If it works for you, you can use our widget or our API. If you want to use the API, we have a PHP wrapper already written for your convenience.
Please confirm your callback url is with http:// if you only put www.domain.com then get this issue..

Categories