question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New activity isn't starting in Android

See original GitHub issue

Hello,

I am trying to add a payment library (https://github.com/mayubao/Android-Pay) for android like this:

let activity = app.android.foregroundActivity || app.android.startActivity;
    let d = new Date().getMilliseconds();
    let time = d.toString()

    let  wechatPayReq = new io.github.mayubao.pay_library.WechatPayReq.Builder()
            .with(activity) //activity instance
            .setAppId('wxd930ea5d5a258f4f') //wechat pay AppID
            .setPartnerId("1900000109")//wechat pay partner id
            .setPrepayId("1101000000140415649af9fc314aa427")//pre pay id
        //	.setPackageValue(wechatPayReq.get)//"Sign=WXPay"
            .setNonceStr("1101000000140429eb40476f8896f4c9")
            .setTimeStamp(time)//time stamp
            .setSign("7FFECB600D7157C5AA49810D2D8F28BC2811827B")//sign
            .create();
//2. send the request with wechat pay
io.github.mayubao.pay_library.PayAPI.getInstance().sendPayRequest(wechatPayReq);

But it isn’t starting new activity & nothing happening. I tried this way:

let activity = utils.ad.getApplicationContext();
    let d = new Date().getMilliseconds();
    let time = d.toString()

    let  wechatPayReq = new io.github.mayubao.pay_library.WechatPayReq.Builder()
            .with(activity) //activity instance
            .setAppId('wxd930ea5d5a258f4f') //wechat pay AppID
            .setPartnerId("1900000109")//wechat pay partner id
            .setPrepayId("1101000000140415649af9fc314aa427")//pre pay id
            .setNonceStr("1101000000140429eb40476f8896f4c9")
            .setTimeStamp(time)//time stamp
            .setSign("7FFECB600D7157C5AA49810D2D8F28BC2811827B")//sign
            .create();
//2. send the request with wechat pay
io.github.mayubao.pay_library.PayAPI.getInstance().sendPayRequest(wechatPayReq);

But showing this error:

08-19 10:40:50.627  4706  4706 F art     : art/runtime/java_vm_ext.cc:470]     from java.lang.Object com.tns.Runtime.callJSMethodNative(int, int, java.lang.String, int, boolean, java.lang.Object[])
08-19 10:40:50.627  4706  4706 F art     : art/runtime/java_vm_ext.cc:470]   at com.tns.Runtime.callJSMethodNative(Native method)
08-19 10:40:50.627  4706  4706 F art     : art/runtime/java_vm_ext.cc:470]   at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1043)
08-19 10:40:50.627  4706  4706 F art     : art/runtime/java_vm_ext.cc:470]   at com.tns.Runtime.callJSMethodImpl(Runtime.java:925)
08-19 10:40:50.627  4706  4706 F art     : art/runtime/java_vm_ext.cc:470]   at com.tns.Runtime.callJSMethod(Runtime.java:912)
08-19 10:40:50.627  4706  4706 F art     : art/runtime/java_vm_ext.cc:470]   at com.tns.Runtime.callJSMethod(Runtime.java:896)
08-19 10:40:50.627  4706  4706 F art     : art/runtime/java_vm_ext.cc:470]   at com.tns.Runtime.callJSMethod(Runtime.java:888)
08-19 10:40:50.695  4706  4706 F art     : art/runtime/runtime.cc:403]   at com.tns.Runtime.callJSMethodNative(Native method)
08-19 10:40:50.695  4706  4706 F art     : art/runtime/runtime.cc:403]   at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1043)
08-19 10:40:50.696  4706  4706 F art     : art/runtime/runtime.cc:403]   at com.tns.Runtime.callJSMethodImpl(Runtime.java:925)
08-19 10:40:50.696  4706  4706 F art     : art/runtime/runtime.cc:403]   at com.tns.Runtime.callJSMethod(Runtime.java:912)
08-19 10:40:50.696  4706  4706 F art     : art/runtime/runtime.cc:403]   at com.tns.Runtime.callJSMethod(Runtime.java:896)
08-19 10:40:50.696  4706  4706 F art     : art/runtime/runtime.cc:403]   at com.tns.Runtime.callJSMethod(Runtime.java:888)
08-19 10:40:50.698  4706  4706 F art     : art/runtime/runtime.cc:403]   at com.tns.Runtime.callJSMethodNative(Native method)
08-19 10:40:50.698  4706  4706 F art     : art/runtime/runtime.cc:403]   at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1043)
08-19 10:40:50.698  4706  4706 F art     : art/runtime/runtime.cc:403]   at com.tns.Runtime.callJSMethodImpl(Runtime.java:925)
08-19 10:40:50.698  4706  4706 F art     : art/runtime/runtime.cc:403]   at com.tns.Runtime.callJSMethod(Runtime.java:912)
08-19 10:40:50.698  4706  4706 F art     : art/runtime/runtime.cc:403]   at com.tns.Runtime.callJSMethod(Runtime.java:896)
08-19 10:40:50.698  4706  4706 F art     : art/runtime/runtime.cc:403]   at com.tns.Runtime.callJSMethod(Runtime.java:888

Any suggestion please? I am using NativeScript with Angular.


tns --version
3.1.3

"tns-android": {
      "version": "3.1.1"
    }

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jibon57commented, Aug 22, 2017

@Plamen5kov , Thank you !! You were right, there is no issue. I tried with real device with wechat installed & it’s working now 😃 … Anyway thanks again 😃

0reactions
lock[bot]commented, Aug 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android new activity not starting - Stack Overflow
I added the new activity in app's manifest correctly (just name, label, theme and screen orientation). Here's the code public class MainActivity ...
Read more >
Restrictions on starting activities from the background
Android 10 (API level 29) and higher place restrictions on when apps can start activities when the app is running in the background....
Read more >
View & control activity in your account - Android
Your activity is listed as individual items, starting with the most recent. Find activity. Steps to go to My Activity: On your Android...
Read more >
Different Ways to fix “Default Activity Not Found” Issue in ...
Different Ways to fix “Default Activity Not Found” Issue in Android Studio · Method 1: Cleaning your project · Method 2: Cleaning and...
Read more >
How to open a new Activity from a Button click ... - YouTube
https://youtu.be/nEe7bx_IuOQ Android Wordle clone in Java - My Version word up ; https://youtu.be/2vXyapfT3B4 How to create an MCQ App using ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found