Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Custom Activities and TNS incompatibility #2028

Closed
enchev opened this issue Sep 2, 2016 · 8 comments
Closed

Android Custom Activities and TNS incompatibility #2028

enchev opened this issue Sep 2, 2016 · 8 comments
Assignees
Milestone

Comments

@enchev
Copy link
Contributor

enchev commented Sep 2, 2016

From @enchev on September 1, 2016 11:42

From @NathanaelA on August 24, 2016 21:40

If you create a custom activity in your NativeScript application; TNS can no longer launch the app because it assumes the name of the launch activity is com.tns.NativeScriptActivity and well, it has a new name when you build a custom activity...

Copied from original issue: #2012

Copied from original issue: NativeScript/NativeScript#2658

@enchev
Copy link
Contributor Author

enchev commented Sep 2, 2016

Hey @slavchev @hshristov can you comment on this?

@enchev
Copy link
Contributor Author

enchev commented Sep 2, 2016

From @Plamen5kov on September 1, 2016 12:1

Hi @NathanaelA,
If you want to start up a custom activity you need to update the app/App_Resources/Android/AndroidManifest.xml of your application with the custom activity you want to use. It's true that by default we use com.tns.NativeScriptActivity, but this is easily configurable.

@enchev
Copy link
Contributor Author

enchev commented Sep 2, 2016

From @NathanaelA on September 1, 2016 17:31

@Plamen5kov -- LOL I think you misunderstand what I was reporting.. I know exactly how to implement it. ;-) I have an app that I have to do a custom activity on.

The issue is that when a developer does implement it, TNS can't launch the app; because it is hard coded to use com.tns.NativeScriptActivity. This had me confused for a few minutes why it wasn't launching, then I noticed my LiveEdit plugin was doing the same thing. Then it hit me that I changed the activity and we both were hard coding it to a specific Activitiy Name. My LiveEdit plugin has already been updated to fix this issue (it now reads the AndroidManifest) ; but I figured I should report it to you guys so that you can fix it in the tns command so that others in the future aren't hit by this...

@enchev
Copy link
Contributor Author

enchev commented Sep 2, 2016

From @NathanaelA on September 1, 2016 17:37

@enchev I just realized you dropped this in the NativeScript repo; this is NOT a CORE modules issue; this is a TNS command line issue (which is why I put it in that repo. 😀).

TNS command line assumes the name of the Android startup activity is com.tns.NativeScriptActivity which 99% of the time is a valid assumption. However in Android if you need to change things in the default Activity you currently have to create your OWN activity (and so it has it's own name) and then that activity is what is built into the app and it is the main activity that needs to be launched with TNS is attempting to launch the app on android. TNS unfortunately is still attempting to launch the com.tns.NativeScriptActivitiy activity which does not do anything...

@enchev
Copy link
Contributor Author

enchev commented Sep 2, 2016

Wow! My mistake! Hey @rosen-vladimirov do you know how to fix hardcoded com.tns.NativeScriptActivity?

@rosen-vladimirov
Copy link
Contributor

Well, it should be implemented. Currently the value is hardcoded, maybe CLI should read it from AndroidManifest.xml or have a custom --activity parameter. In case the value is written in AndroidManifest.xml I vote for getting it from there. This should cover all scenarios. But we must be sure that we've read the correct activity from the manifest.

@enchev enchev added the bug label Sep 2, 2016
@NathanaelA

This comment was marked as abuse.

@enchev
Copy link
Contributor Author

enchev commented Sep 2, 2016

Why not use simply: adb shell monkey -p PACKAGE_NAME 1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants