New creating Plugins


#1

Hello Community
I’m pretty new stating creating plugins.

I tried different ways to translate this code in android to nativescript using typescript

private void startlogin() {
	Intent intent = new Intent(MainActivity.this,
			com.cisco.dft.oauth.activities.LoginActivity.class);

	intent.putExtra(AuthConstants.KEY_NEXT_ACTIVITY, MainActivity.class);
	intent.putExtra(AuthConstants.KEY_APP_TITLE,
			getResources().getString(R.string.app_name));
	startActivity(intent);
	finish();
}

I’ll appreciate some help to understant how can I translate this code to create the plugin that I need for my app.

Thanks


#2

If you shared what you’ve attempted, we might be able to provide proper guidance.

Here are two articles you may find useful. Also - other nativescript plugins, even the tns-core-modules themselves are great sources to learn how to use Java classes in javascript.

https://docs.nativescript.org/runtimes/android/metadata/accessing-packages

https://docs.nativescript.org/runtimes/android/marshalling/java-to-js