I just added OneSignal to my Cordova project. This appears to use Google Play services i.e. (I get a message "No valid Google Play services APK found"). I was wondering the best approach for adding it.
I have Google Play services v8.4.89 installed on my phone.
I have Google Play services installed via the SDK manager:
This creates a google_play_services folder (without a lot in it):
UPDATE
As per this Google has broken down Google Play Services into multiple libraries (.aar) located at:
android-sdk\extras\google\m2repository\com\google\android\gms
build.gradle dependencies:
I'm a little unsure of what to do next. I thought I could have potentially used this.
I might add I am using IntelliJ and have tried to import the JAR manually as per this.
Thanks,
The OneSignal error "No valid Google Play services APK found" means that the "Google Play services" app is missing from the device or is most likely just out of date. It should check the version under Settings>Apps. It should update automatically in the background after you open the Google Play store on the device and sign in. See the following link for more details.
https://documentation.onesignal.com/docs/all-users-are-shown-as-not-subscribed
You need to add it to your project library..
File >> Import, select Android > Existing Android Code into Workspace, browse to the library project (your android sdk env) to import it. extras/google/google_play_services/
After this.. you need to open the properties for your project..
Right click on your project and click properties select android and under the library section add the google lib.
Related
My project is open source and implements features from Google Play Services such as location. I'm having trouble in that when I upload my project to GitHub for instance, when the project is downloaded onto another user's machine to be worked on, all the references to Google Play Services become 'cannot be resolved' errors. Even uploading and redownloading the source on my own machine which has the Google Play Services SDK results in errors. Apparently the source code needs to be manually linked to the Google Play Services SDK each time it is imported to a different machine.
Is there a way to include the Google Play Services code in the source without requiring each user that downloads it to manually set up the Google Play Services SDK?
https://github.com/owncloud/android/blob/master/SETUP.md
This is a setup guide of another app. in it you can see setup_env scripts. You can have a solution like this and write a setup guide like this one for users who want to build.
I have downloaded a demo project of GSM services.
For using it, I need to install a file name Google could messaging but, it is missing from my SDK.
How can I add this file to my SDK?
New To Android
If you use GCMS (Google Cloud Messaging Services), you need to build a library project which uses Play Services and import it into your work-space.
Generally:
Install the Android SDK from this link.
Download and configure the Google Play services SDK, which includes the Google Maps Android API. You can see the setting up on this link.
Don't forget to add the required Google Play services settings in your application's manifest.
When you add the Play Services library to your project, be sure to add it with resources, as described in Setup Google Play Services SDK. The key point is that you must reference the library. Simply adding .jar file to your project won't work. You must follow the directions for referencing a library, or your app won't be able to access the library's resources, and it won't run properly.
You can get the full instructions from Setting Up Google Play Services.
I already added the support for GCM at our android app, however one thing bothers me is about the Google Play services library project. Based on this link Set Up Google Play Services SDK, I should do the following at step 4:
Make a copy of the Google Play services library project.
If you are using Eclipse, import the library project into your workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
We are using eclipse. So to allow other developer to build our app project without doing any manual work, I checked in the Google Play services library project into our version control (SVN) and add that project as part of our app project.
However I am not sure whether I should check that project into our source version control or not. One thing I also found out that google-play-services_lib.jar file is modified today, however I didn't do anything to that jar and I don't have any idea how it got updated. Should I check in the new version of the jar file? Again this still goes back to whether I should check in the Google Play services library project in the first place.
Could someone with GCM experience shed some lights what's the best approach here?
Update 1 at Jan 16:
Per the answer below, we could add a Google play services jar file to our app project, however based on this link, Implementing GCM Client, it has the following:
Caution: When you add the Play Services library to your project, be sure to add it with resources, as described in Setup Google Play Services SDK. The key point is that you must reference the library—simply adding a .jar file to your Eclipse project will not work. You must follow the directions for referencing a library, or your app won't be able to access the library's resources, and it won't run properly
So that would means that we could not just simple add the jar file.
Your library compiles first whenever you compile your application, as library projects create jar your Google Play Services jar will be updated on every run.
As the library incluse resources you cant create the jar and add them in to your java build path there two possible ways to get rid of this :
Move to Android Studio which uses .aar files which contains all your andorid resources in archive. Read more from refrence.
Prevent libray project to compile each and every time you run the app in eclipse. Click Here to know how to do that.
The guide to setting up GCM here: https://developer.android.com/google/gcm/client.html specifies:
Caution: When you add the Play Services library to your project, be sure to add it with resources, as described in Setup Google Play Services SDK.
Then the page it links to (https://developer.android.com/google/play-services/setup.html#Setup) never mentions the 'with resources' bit.
Does anyone know what this means, as I fear I've missed something when setting up my play services project.
With recources means as library project, not as JAR file.
Install the Google Play services from SDK manager.
After install it will be at /extras/google/google_play_services/libproject/google-play-services_lib/
So? you can copy this folder in you workspace? if you need.
If you are using Eclipse, import the library project into your workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
Add Referense to Google Play services in your project. Example http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject
Does anyone know what this means
I suspect that it is a clumsy way of emphasizing that you need to attach the Play Services SDK Android library project to your app, rather than just copying over some JAR.
I am using Android 2.3.6 Device for testing. When I run the Google Map android api v2 on the device it doesnot show the map on the device and also show the error on logcat as follows
Google Maps Android API Authorization failure.
Also on the Console It shows the
[2012-12-07 13:59:42 - google-play-services_lib] Could not find google-play-services_lib.apk!
Please Help Me!!!!!!!!
I also found that the play services libproject has to be imported onto the same physical drive as your project. (which may not be the case if you didn't check the 'Copy projects into workspace' checkbox)
Setting up a Library Project
I just added the project of google services and added a reference in my project property->Android
check above link.
First of all download the latest google play services revision 3.
Import the google play services libproject as a library in Eclipse.
Then go to properties>Android and below add the above project as a library to your project.
Also ensure that the google play services are updated on your device.Use the debug keystore if you are directly running the app on the device.You will have to add the sha1 print and package of the debug keystore while creating Android key.
Refer to this example :
https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw
Unfortunately for using the Google Maps you have to test the application on a real device as the emulator is not supported.