We integrated libGoogleAnalyticsServices.jar in our app and it is working fine. By default it includes 'VERSION_CODE' from BuildConfig.java when sending messages to Google Analytics service. I'd like to include 'VERSION_NAME' instead of 'VERSION_CODE'.
1. Is there a way to get a project for libGoogleAnalyticsServices.jar?
2. Is there a way to configure libGoogleAnalyticsServices class to send version_name instead of version_code?
Related
Using App action test tools in Android Studio for testing Google Actions, I'm getting the error
Preview Creation Error Status Code: 400 Message: Precondition check failed.
The requested Android app package name does not have an associated project
in Play Console. Please create a draft in Play Console and upload an app
with package name 'com.example.yadayada'.
If I try to "upload an app with packagename ..."
I'm getting the error
Upload failed
You have uploaded an APK or Android App Bundle that contains an action schema
document in the manifest file, but the action patterns are not yet allowed.
If you participate in a beta program, you must obtain authorization
for your developer account
Ok, but where and how can i do it ?
Furthermore, I don't have to publish an application, this is just a draft to test the implementation of possible future Slices, and the documentation states that it is possible to do it through the Android Studio plugin.
Ok, got it. Hints here
Create a new application in developer console without actions, and use
its package name in the test application with actions. You can use any package names that you have already registered in Console
android {
defaultConfig {
applicationId "com.example.yadayada.playconsole"
}
}
You need to add this to the manifest file:
<meta-data
android:name="android.app.shortcuts"
android:resource="#xml/shortcuts" />
This is explained in the app actions tutorial and also here: https://developer.android.com/guide/topics/ui/shortcuts/creating-shortcuts#static
Play services API suggests that there is something called Instance ID
However, after including the following in Android Studio, I am unable to import InstanceID class
compile "com.google.android.gms:play-services-identity:${googlePlayServicesVersion}"
compile "com.google.android.gms:play-services-auth:${googlePlayServicesVersion}"
Per this SO Post, InstanceID class should work if I include the identity play services library.
Following conversion of google cloud messaging to firebase cloud messaging, I believe, it must have been replaced by Firebase Instance ID as mentioned in the red message here.
Now I am not sure if using Firebase ID should have indeed "replaced" Instance ID.
Or, maybe I am missing some library which includes InstanceID?
Yap,
I had the issue, and finally I realize that InstanceID class is a part of 'com.google.android.gms:play-services-iid' library , so you just have to add this line in your gradle build file:
compile "com.google.android.gms:play-services-iid:${googlePlayServicesVersion}"
Unless this works for me :) ...
I’m working on CI for android app and for those purpose I’ve created test app.
I’ve added Crashlytics support and a little bit later productFlavors to the app.
My initial package name was ‘com.kagarlickij.myapplication’ ,
Flavours add applicationIdSuffix to the package name (http://prntscr.com/hm0u3s) and result is e.g. ‘com.kagarlickij.myapplication.staging’
If I build app with package name ‘com.kagarlickij.myapplication’ it uploads to Crashlytics fine,
But if I build app with package name ‘com.kagarlickij.myapplication.staging’ new app doesn't appear in Crashlytics.
In both cases console output doesn't have any errors - http://prntscr.com/hm0svq
build.gradle (and the whole app) - https://github.com/kagarlickij/MyApplication/blob/dev/0.3.0/app/build.gradle
Why it goes like this and how it can be fixed?
The answer turned out to be very simple, but not very obvious - you have to run app built with new flavor in emulator at least once and will become available on Crashlytics - http://prntscr.com/hm25sa
I have to integrate the flurry ad in my android application. Can anybody provide the steps to integrate the flurry ad. I have gone through official sdk for flurry but not get any idea. I have followed the link android: Flurry Ads Banner taking Full screen
I have used the code not get any results
FlurryAgent.onStartSession(this, getString(R.string.flurry_api_key));
FlurryAds.fetchAd(this, "ANDROID_BANNER_TOP", mBanner,
FlurryAdSize.BANNER_TOP);
Prerequisites
Flurry Analytics requires a minimum Android API level 10.
Flurry Analytics uses the Android Advertising ID provided by Google Play Services and will check for and respect the user’s ad tracking preference.
Get your API Keys
Start by creating an app. Once you create the app, you’ll receive a Flurry API Key, which you’ll need when using the SDK.
Download the Flurry Android SDK
There are currently two ways of getting the Flurry Android SDK into your application:
Install via jCenter (Recommended):
The Flurry SDK is available via jCenter. You can add it to your application by including the following in your build.gradle file:
// In your top level Gradle config file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
// In your main app's Gradle config file:
dependencies {
compile 'com.flurry.android:analytics:6.3.1'
/*
* Optional library to help in monetizing your app with ads.
* If you include the ads library, you do not need to include
* the analytics library as it is a transitive dependency.
*/
// compile 'com.flurry.android:ads:6.3.1'
//... other dependencies
}
Download .jar files from Flurry Dev Portal
The downloaded archive should contain these files for use with Flurry Analytics:
FlurryAnalytics_x.y.z.jar: The library containing Flurry’s analytic collection and reporting code (where x.y.x denotes the latest version of Flurry SDK).
FlurryAds_x.y.z.jar: The optional library to incorporate Flurry’s ads into your application (where x.y.x denotes the latest version of Flurry SDK).
ProjectApiKey.txt: This file contains the name of your project and your project’s API key.
FlurryAndroidAnalyticsReadmevx.y.z.pdf: A PDF file with instructions (where x.y.x denotes the latest version of Flurry SDK).
Add the FlurryAnalytics_x.y.z.jar to your classpath¶
Using Android Studio:
If using Android Studio, you do not need to do anything further to include the Flurry SDK in your project, as long as you have installed the SDK through jCenter in your Gradle configuration.
However, if you prefer to use the downloaded .jar files, follow these procedures:
Add FlurryAnalytics-5.x.x.jar to your project’s libs folder.
Navigate to File > Project Structure > Module > Dependencies. Click the ‘+’ button in the bottom of the ‘Project Structure’ popup to add dependencies. Select ‘File dependency’ and add libs/FlurryAnalytics-5.x.x.jar.
Add Google Play Services library. If selectively compiling individual Google Play Service APIs, you should include the Google Analytics API.
Using Eclipse
Add FlurryAnalytics-5.x.x.jar to your project’s libs folder. Right-click on each JAR file and select Build Path > Add to Build Path.
Add the Google Play Service library jar file.
Configure your AndroidManifest.xml
- Have access to the Internet and allow the Flurry SDK to check state of the network connectivity.
- Specify a versionName attribute in the manifest to have data reported under that version name.
- Declare min version of that Android OS that the app supports. Flurry supports Android OS versions 10 and above.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.flurry.sample"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="21" />
<!--required permission-->
<uses-permission android:name="android.permission.INTERNET" />
<!--optional permission - highly recommended-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!--optional permission -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:name=".MyApplication"
android:icon="#drawable/app_icon">
<!--your activities -->
</application>
</manifest>
Add calls to init, onStartSession and onEndSession
Follow these steps, adding these calls:
If you are shipping an app, insert a call to FlurryAgent.init(Context, String) in your Application class, passing it a reference to your application Context and your project’s API key:
//If you are shipping an app, extend the Application class if you are not already doing so:
public class MyApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
new FlurryAgent.Builder()
.withLogEnabled(false)
.build(this, FLURRY_API_KEY);
}
}
Alternatively, you may call init() just before onStartSession(). It is safe to call init() more than once, provided that you use the same API key throughout the application. You may use any type of Context you wish.
If you are writing an app and the minimum target is Ice Cream Sandwich or above (minSdkVersion is set to API level 14 or greater), session handling is completely automatic, and you may skip steps 3 and 4. If you are instrumenting another type of Context, such as a Service, or your minimum target is Gingerbread, proceed with steps 3 or 4.
Insert a call to FlurryAgent.onStartSession(Context) in the Activity’s onStart() method, passing it a reference to a Context object (such as an Activity or Service). If you are targeting Gingerbread, Flurry recommends using the onStart() method of each Activity in your app, and passing the Activity itself as the Context object. For services (or other Contexts), use the Service or the relevant Context as the Context object. Do not pass in the global Application context.
Insert a call to FlurryAgent.onEndSession(Context) in the Activity’s onStop() method, when a session is complete. If you are targeting Gingerbread, we recommend using the onStop method of each Activity in your app. For services (or other Contexts), ensure that onStop is called in each instrumented Service. Make sure to match up a call to onEndSession for each call of onStartSession, passing in the same Context object that was used to call onStartSession. Do not pass in the global Application context.
As long as there is any Context that has called onStartSession() but not onEndSession(), the session will be continued. Also, if a new Context calls onStartSession() within 10 seconds of the last Context calling onEndSession(), then the session will be resumed, instead of a new session being created. Session length, usage frequency, events and errors will continue to be tracked as part of the same session. This ensures that as a user transitions from one Activity to another in your app that they will not have a separate session tracked for each Activity, but will have a single session that spans many activities. If you want to track Activity usage, Flurry recommends using logEvent(), as described in the Custom Events section.
If you wish to change the window during which a session can be resumed, call FlurryAgent.setContinueSessionMillis(long milliseconds) before the call to FlurryAgent.init().
The Flurry SDK automatically transfers the data captured during the session once the SDK determines the session completed. In case the device is not connected, the data is saved on the device and transferred once the device is connected again. The SDK manages the entire process. Currently, there is no way for the app to schedule the data transfer.
You’re done! That’s all you need to do to begin receiving basic metric
data.
I wonder if there is a way to get notified about updates of the Google Android libraries such as com.android.support:support-v4, com.android.support:appcompat-v7 and so on.
I am aware that I could use compile "com.android.support:support-v4:18.0.+" with the + in my gradle build. But it would be nice to get an eMail or have an RSS Feed with the new releses of all the different android libraries by google. This would help a lot to keep the dependencies up to date and publish a new version of my app to the play store.
Edit:
I found this url https://dl.google.com/android/repository/addon.xml which is used to update the local m2repo (which includes the above mentioned librarys).
A real "push" notification solution would require lots of boring details like setting up xmpp or email accounts. However, this is a very valid question and one I have recently solved not just for appcompat libraries but for all my dependencies.
gradle-versions-plugin
This excellent plugin analyzes your depdencies and checks for newer releases. Example console output:
$ gradle dependencyUpdates
...
The following dependencies are using the latest milestone version:
- com.android.support:appcompat-v7:23.1.1
- com.android.support:cardview-v7:23.1.1
- com.android.support:recyclerview-v7:23.1.1
- com.android.support:support-annotations:23.1.1
- com.android.support.test:rules:0.4.1
- com.android.support.test:runner:0.4.1
- com.github.ben-manes:gradle-versions-plugin:0.11.3
The following dependencies have later milestone versions:
- com.android.tools.build:gradle [1.5.0-beta1 -> 2.0.0-alpha1]
- com.google.android.gms:play-services-gcm [7.5.0 -> 8.3.0]
- com.squareup.retrofit:retrofit [1.9.0 -> 2.0.0-beta2]
- net.hockeyapp.android:HockeySDK [3.5.0 -> 3.7.0-beta.2]
- org.hamcrest:hamcrest-library [1.1 -> 1.4-atlassian-1]
- org.mockito:mockito-core [1.10.19 -> 2.0.31-beta]
You can just run this any time you want to check for newer versions. And since it also supports json output format, if you really wanted to script some kind of notification, you could cronjob it and parse the json output and do whatever you'd like at that point.
Your question is interesting and it made me think on how I may address myself the problem to actually find a solution. Here's my thought: I use myself ifttt and alike and the missing point is then the monitoring of the xml data. A Google search later, I've just found this blog post which is a thoroughful description of the steps needed to get notified by mail of a change in a web page. HEY, THAT'S WHAT WE NEED!!!
I've not tested since I need to wait for an actual update but here is the resulting RSS: page2RSS android addon monitoring
Update (May 9): page2rss has been shut down on May 1st, as a consequence other services must be used/tested. Wachete seems to provide similar services, but one needs an account.
I don't know if there is an RSS or something like that, but you can visit periodically this page:
http://developer.android.com/tools/support-library/index.html
Or visit the Android Developers Blog (often Ian Lake, a Google Developer Advocate, update it with pertinent posts):
http://android-developers.blogspot.com/