Android automatic action run

KuvaajaKuvaaja USMember

Hi.

I'm asked that same question before but I want to ask that again.

@Kuvaaja said:
Hi.
How can I run Android action automatically without button click (in app) when app is launched?

If possible, please write code with Java, classes and @Overrides. Because I'm beginner.

Regards,
Teemu

I mean how to launch my public void called redirecti automatically when my app is launched?
Code:
public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

public void redirecti(View view) {
    Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.app.package");
    if (launchIntent != null) {
        startActivity(launchIntent);
    }
}

}

I don't mean any user with @Override or @Overrides.
I am using Android Studio.
I know to how to start that with button click but no without button click.
Please help me.

Best regards
Kuvaaja or Teemu

Answers

  • JimBennettJimBennett GBXamarin Team, Insider, University, Developer Group Leader ✭✭✭✭

    You can ask, but I don't think you'll get much help here. You are using Android Studio to write Java apps, this is a forum for Xamarin apps built using C# or F# in Visual Studio or Xamarin Studio. So this is not the place to ask.

    Maybe try on Stack Overflow?

  • KuvaajaKuvaaja USMember

    Thanks about the answer.
    Maybe I try on Stack Overflow.
    I'm new in Xamarin.
    Sorry about that question. :(

Sign In or Register to comment.