I'm not getting install referrer received on application installed from the play store. Below is my Androidmanifest.xml shows receiver which is inside <application> tag too.
<receiver
android:name="com.usplnew.getreferrer.CustomReceiver"
android:exported="true" >
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
And below is code for Receiver
public class CustomReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
System.out.println("sgn RECEIVED");
Log.d("YES", "IT WORKS!!");
Toast.makeText(context, "Received Intall Referrer", Toast.LENGTH_SHORT)
.show();
}
}
Its working well with below command on emulator and device too
adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n com.uspl.getrefferer/com.uspl.getrefferer.CustomReceiver --es "referrer" "https://play.google.com/store/apps/details?id=com.NextGen.Water.Run&referrer=IWantThisReferrer"
I also put the same below code into the app into the production on Google Play. But INSTALL REFERRER is not received when the application is installed.
I would highly appreciate if someone guide where I'm wrong.
Thanks in Advance!
Have you checked your implementation of your own class of BroadcastReceiver with this documentation - https://developers.google.com/analytics/devguides/collection/android/v1/devguide#campaigns
?
Related
I can't seem to catch this and I also can't see it being sent in Logcat. From reviewing ACTION_MY_PACKAGE_REPLACED not received, it appears MY_PACKAGE_REPLACED should be all I need for API22.
What am I missing?
Thank you.
Snippet from AndroidManifest.xml
<receiver
android:name=".BootReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
BootReceiver
class BootReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if (intent.action == "android.intent.action.BOOT_COMPLETED" ||
intent.action == "android.intent.action.MY_PACKAGE_REPLACED") {
Log.d(TAG, "Caught BOOT_COMPLETED or PACKAGE_REPLACED action!")
GlobalScope.launch(Dispatchers.IO) {
...
}
}
}
}
Upon further investigation, this works properly if Android Studio (AS) is removed from the picture; use it to build the APK and, perhaps, view Logcat, but that’s it. If I only install/replace the app from the command line/Terminal, and do not Run app and related from AS, this works as intended. In my case, since I frequently install/Run from AS, I had to do the following TWICE and android.intent.action.MY_PACKAGE_REPLACED was caught the SECOND time:
adb -s emulator-5554 install -r app-debug.apk
I repeat, running the app from Android Studio, in this regard, severally messes with android.intent.action.MY_PACKAGE_REPLACED and I, sadly, lost a couple of hours figuring this out!
Broadcast which should be sent to the application just after app is installed on TV is not received.
I declared BR in Manifest.xml:
<receiver
android:name=".RunOnInstallReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.media.tv.action.INITIALIZE_PROGRAMS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
I declared also:
<uses-feature
android:name="android.software.leanback"
android:required="true" />
RunOnInstallReceiver class is very simple:
public class RunOnInstallReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
Log.v("RAMPS", "Broadcast received");
}
}
I tried with nVidia Shield and Mi Box 3 - no success. Anyone had similar problem?
Are you side loading the application? INITIALIZE_PROGRAMS is only sent when the application is installed via the store.
When side loading (installing from adb or android studio), you can trigger the intent with:
adb shell am broadcast -a android.media.tv.action.INITIALIZE_PROGRAMS -n com.your.app.package/.YourReceiver
Answer is from bullet #5 in Android developer guide for creating a channel on the home screen: https://developer.android.com/training/tv/discovery/recommendations-channel#creating_a_channel
In my case, if you use product flavor you should trigger by:
adb shell am broadcast -a android.media.tv.action.INITIALIZE_PROGRAMS -n X/Y
X is your applicationID.
Y is the link of your broadcast received file in your project.
Example: You build your application with Build variants staging and trigger is:
adb shell am broadcast -a android.media.tv.action.INITIALIZE_PROGRAMS -n com.google.android.staging/com.google.android.tvhomescreenchannels.RunOnInstallReceiver
Here is ApplicationId:
Here is path RunOnInstallReceiver:
I'm trying to have install referrer on my android app, but failed for something.
I need to receive variables when someone download/install my app form appstore. So I install a cordova plugin, android-referrer-plugin, into my app. And then try it:
adb shell
and then
am broadcast -a com.android.vending.INSTALL_REFERRER \
-n com.mypackage.app/com.eightz.mobile.cordova.plugin.android.referrer.Receiver \
--es "referrer" "This is my referrer"
And then I've got a response like this:
Broadcasting: Intent { act=com.android.vending.INSTALL_REFERRER cmp=com.mypackage.app/com.eightz.mobile.cordova.plugin.android.referrer.Receiver (has extras) }
And that's it.. I don't see
Broadcast completed: result=0
I'm not sure if it's long loading for something or what, but I never see this line, and I cannot further on.
I check if I can get the variable, but I just got empty variable. No error though..
Could someone point my mistake here?
Did you regsiter broadcast receiver in manifest. Did you set intent filter to that receiver in manifest too.
<receiver android:name="com.mobileapptracker.Tracker" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
Please find the below code for more information.
<receiver
android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:exported="true"
android:enabled="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER"/>
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.CampaignTrackingService"
android:enabled="true"/>
This is what I have done for implementing Campaign Measurement - Android SDK v4.
In order to check is it working or not, when I try to run this on terminal:
adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n
"com.example.android/com.google.android.gms.analytics.CampaignTrackingReceiver"
--es referrer "utm_source=testSource&utm_medium=testMedium&utm_term=testTerm&utm_content=testContent&utm_campaign=testCampaign"
it successfully cast an intent
Broadcasting: Intent { act=com.android.vending.INSTALL_REFERRER
cmp=com.example.android/com.google.android.gms.analytics.CampaignTrackingReceiver
(has extras) } Broadcast completed: result=0
and when I run my application I get the log as follows:
CampaignTrackingReceiver is not registered, not exported or is disabled. Installation campaign tracking is not possible. See http://goo.gl/8Rd3yj for instructions.
I had tried many example but not got the sufficient result. Anyone if knows the whole working then please provide me a link or if anybody knows the exact steps plz list them.
Thanxx in advance
I am trying to setUp google analytics campaign measurements measurements .
here is what i did :
1.
i've declared the receiver in the manifest file:
<!-- Enable Google Play Store Campaign reports -->
<receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:exported="true"
android:permission="android.permission.INSTALL_PACKAGES">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.analytics.CampaignTrackingService"
android:enabled="true" />
I install the app on my device using this command:
./adb install debug.apk
then i run this using my terminal , to broadcast the intent :
./adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n "com.mypackgename/com.google.android.gms.analytics.CampaignTrackingReceiver" --es referrer "utm_source=test2Source&utm_medium=testMedium&utm_term=testTerm&utm_content=testContent&utm_campaign=testCampaign"
which return this :
Broadcasting: Intent { act=com.android.vending.INSTALL_REFERRER cmp=com.mypackagename/com.google.android.gms.analytics.CampaignTrackingReceiver (has extras) }
Broadcast completed: result=0
but i got this in my log:
Thread[GAThread,5,main]: No campaign data found.
what should i do to make it work, i'v try a lot of things but without luck.
You'll have to URL encode the arguments in the referrer string.
Please try the following:
./adb shell am broadcast -a com.android.vending.INSTALL_REFERRER -n "com.mypackgename/com.google.android.gms.analytics.CampaignTrackingReceiver" --es referrer "utm_source%3Dtest2Source%26utm_medium%3DtestMedium%26utm_term%3DtestTerm%26utm_content%3DtestContent%26utm_campaign%3DtestCampaign"
For more information check out: How to test android referral tracking?