Reputation: 2562
If any one have idea when app install, I want to send user information with out user interaction.Please help me thanks in advance.which method will call when installing app in device.
Upvotes: 0
Views: 146
Reputation: 3576
there are many samples on net . pls google on it. some url are
http://www.vogella.com/tutorials/AndroidServices/article.html http://examples.javacodegeeks.com/android/core/service/android-service-example/ http://developer.android.com/reference/android/app/Service.html
to get user info
http://developer.android.com/training/contacts-provider/index.html
.which method will call when installing app in device.
use "shared preference" . after install the app , change the boolean value is true.
handle that condition . initially it has be false at that time you call the service. after that you change the boolean value.
Upvotes: 0
Reputation: 53647
You can listen to android.intent.action.PACKAGE_ADDED
broadcast do your task in receiver like following
Register Receiver
<receiver android:name=".ApplicationInstallationListener">
<intent-filter android:priority="100">
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<data android:scheme="package"/>
</intent-filter>
</receiver>
ApplicationInstallationListener.java
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class ApplicationInstallationListener extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent arg1) {
// TODO send user information
}
}
Upvotes: 0
Reputation: 1973
You would create a service, and in your Manifest.xml you would register a BroadcastReceiver for that service that listened for this filter: Intent.ACTION_PACKAGE_INSTALL
Upvotes: 1