Reputation: 62549
Where can I find the android support library with ActivityCompat.getReferrer()
this function ?
I thought it would be in
my build.gradle
looks like this: compile 'com.android.support:support-v4:24.0.1' but its not working.
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//Google
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.google.android.gms:play-services-base:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.android.support:support-v4:24.0.1'
compile 'com.android.support:percent:24.0.0'
}
I am trying to access ActivityCompat.getReferrer()
from a activity that extends AppCompatActivity
in android.support.v7.app package but I can't find this method
Upvotes: 4
Views: 952
Reputation: 6162
Only compile 'com.android.support:appcompat-v7:24.2.1'
is enough for that method as it is a method of ActivityCompat
. Please use same versions' of libraries from support library.
Java code sanple
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
Uri uri = ActivityCompat.getReferrer(SplashActivity.this);
if (uri != null)
Toast.makeText(SplashActivity.this,uri.toString(),Toast.LENGTH_SHORT).show();
}
}
Upvotes: 4