I have a class that extends Application
public class MyApp extends Application
{
@Override
public void onCreate()
{
super.onCreate();
Intent intent = new Intent(this, MyService.class);
startService(intent);
Log.i("Try","App ID = " + intent.getStringExtra("MyID"));
}
}
I also have a Service that generates an ID.
public class MyService extends Service
{
public void onStartCommand(Intent intent, int flags, int startId)
{
intent.putExtra("MyID", getID);
}
public String getID()
{
//code to generate ID
return ID;
}
}
My problem is I need to pass the ID from MyService to MyApp but the Log states "App ID = null".