3

I created an application and immediately after install I need to send a text message to a central server configuration.

How I can do that?

In applications such as WhatApps, just after installing you receive an SMS configuration. Anyone know how to do that.

Janusz
  • 187,060
  • 113
  • 301
  • 369
angel
  • 51
  • 4
  • There's no real way to detect an initial install of your own app, but if your app has a broadcast receiver to detect screen orientation change, or the screen being locked or something else that happens very frequently, you could try that. – Reed Nov 23 '11 at 11:43

3 Answers3

2

check for a boolean flag in shared preferences .

do stuff if not exist and insert this flag to sharedPrefeences .

sharedPreferences get deleted if user clears the data of app so better approach i will say is

you manage device_id on server and do the same thing .

Janusz
  • 187,060
  • 113
  • 301
  • 369
Shailendra Singh Rajawat
  • 8,172
  • 3
  • 35
  • 40
1

You can use Service to run in the background and send the sms. However you cannot start a service directly after installing. The user has to interact with the application first.

See accepted answer and comments from How to start android service on installation .

Community
  • 1
  • 1
Xeno Lupus
  • 1,504
  • 3
  • 12
  • 17
1

Well I think the only possible way is that if there is a broadcast, that you can get after installation of any application. You receive that broadcast and send SMS from a service. But if there is no broadcast then I think you cant directly detect whether an application is just installed or not, or no trigger.

Khawar
  • 5,197
  • 4
  • 28
  • 52