MohsenSaber2019 Member Jul 31, 2020 #1 Hi All ! I want to direct the user to the settings for disabling the phone mobile network in all platform. in android 10 "android.settings.DATA_USAGE_SETTINGS" intent will work correctly. But in some another APIs, "com.android.phone.NetworkSetting" works good. So what I can why this code does not working? Code: Copy Dim In As Intent Try In.Initialize("android.settings.DATA_USAGE_SETTINGS","") Catch In.Initialize("com.android.phone.NetworkSetting","") End Try StartActivity(In) Result: Java: Copy main$ResumableSub_CheckMobileDataresume (java line: 810) android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.phone.NetworkSetting flg=0x20000 } at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1854) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1544) at android.app.Activity.startActivityForResult(Activity.java:4391) at android.app.Activity.startActivityForResult(Activity.java:4335) at android.app.Activity.startActivity(Activity.java:4702) at android.app.Activity.startActivity(Activity.java:4670) at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:857) at iKey.android.SmartKey.main$ResumableSub_CheckMobileData.resume(main.java:810) at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:207) at anywheresoftware.b4a.BA.raiseEvent(BA.java:193) at anywheresoftware.b4a.keywords.Common$1.onClick(Common.java:490) at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:156) at android.app.ActivityThread.main(ActivityThread.java:6517) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
Hi All ! I want to direct the user to the settings for disabling the phone mobile network in all platform. in android 10 "android.settings.DATA_USAGE_SETTINGS" intent will work correctly. But in some another APIs, "com.android.phone.NetworkSetting" works good. So what I can why this code does not working? Code: Copy Dim In As Intent Try In.Initialize("android.settings.DATA_USAGE_SETTINGS","") Catch In.Initialize("com.android.phone.NetworkSetting","") End Try StartActivity(In) Result: Java: Copy main$ResumableSub_CheckMobileDataresume (java line: 810) android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.phone.NetworkSetting flg=0x20000 } at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1854) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1544) at android.app.Activity.startActivityForResult(Activity.java:4391) at android.app.Activity.startActivityForResult(Activity.java:4335) at android.app.Activity.startActivity(Activity.java:4702) at android.app.Activity.startActivity(Activity.java:4670) at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:857) at iKey.android.SmartKey.main$ResumableSub_CheckMobileData.resume(main.java:810) at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:267) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:207) at anywheresoftware.b4a.BA.raiseEvent(BA.java:193) at anywheresoftware.b4a.keywords.Common$1.onClick(Common.java:490) at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:156) at android.app.ActivityThread.main(ActivityThread.java:6517) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
Erel B4X founder Staff member Licensed User Longtime User Jul 31, 2020 #2 The error starts from this call: Common.StartActivity This is line 7 in the above code. It means that you need to move the catch block after this line. Upvote 0
The error starts from this call: Common.StartActivity This is line 7 in the above code. It means that you need to move the catch block after this line.
MohsenSaber2019 Member Jul 31, 2020 #3 Erel said: The error starts from this call: Common.StartActivity This is line 7 in the above code. It means that you need to move the catch block after this line. Click to expand... Thanks Erel. Problem Solved. such a ridiculous mistake ? Upvote 0
Erel said: The error starts from this call: Common.StartActivity This is line 7 in the above code. It means that you need to move the catch block after this line. Click to expand... Thanks Erel. Problem Solved. such a ridiculous mistake ?